Skip to content

Commit

Permalink
Merge pull request #52 from meshery/meshkiterr
Browse files Browse the repository at this point in the history
[Fix] Panic: Meshkit Error
  • Loading branch information
leecalcote authored Oct 20, 2021
2 parents 1f07abe + 8352ac6 commit 9cd6a99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions appmesh/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ var (
ErrStreamEventCode = "appmesh_test_code"
// ErrSampleAppCode failure
ErrSampleAppCode = "appmesh_test_code"
// ErrLoadNamespaceToMeshCode represents the error
// which is generated when the namespace could not be labelled and updated
ErrLoadNamespaceToMeshCode = "appmesh_test_code"
// ErrOpInvalidCode failure
ErrOpInvalidCode = "appmesh_test_code"
// ErrNilClientCode represents the error code which is
Expand Down Expand Up @@ -109,6 +112,11 @@ func ErrProcessOAM(err error) error {
return errors.New(ErrProcessOAMCode, errors.Alert, []string{"error performing OAM operations"}, []string{err.Error()}, []string{}, []string{})
}

// ErrLoadNamespaceToMesh identifies the inability to label the appropropriate namespace
func ErrLoadNamespaceToMesh(err error) error {
return errors.New(ErrLoadNamespaceToMeshCode, errors.Alert, []string{"Could not label the appropriate namespace"}, []string{err.Error()}, []string{}, []string{})
}

// ErrAddonFromTemplate is the error for streaming event
func ErrAddonFromTemplate(err error) error {
return errors.New(ErrAddonFromTemplateCode, errors.Alert, []string{"Error with addon install operation"}, []string{err.Error()}, []string{}, []string{})
Expand Down
4 changes: 2 additions & 2 deletions appmesh/sample_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (appMesh *AppMesh) installSampleApp(namespace string, del bool, templates [
func (appMesh *AppMesh) LoadNamespaceToMesh(namespace string, remove bool) error {
ns, err := appMesh.KubeClient.CoreV1().Namespaces().Get(context.TODO(), namespace, metav1.GetOptions{})
if err != nil {
return err
return ErrLoadNamespaceToMesh(err)
}

if ns.ObjectMeta.Labels == nil {
Expand All @@ -90,7 +90,7 @@ func (appMesh *AppMesh) LoadNamespaceToMesh(namespace string, remove bool) error

_, err = appMesh.KubeClient.CoreV1().Namespaces().Update(context.TODO(), ns, metav1.UpdateOptions{})
if err != nil {
return err
return ErrLoadNamespaceToMesh(err)
}
return nil
}

0 comments on commit 9cd6a99

Please sign in to comment.