diff --git a/appmesh/error.go b/appmesh/error.go index adf1fb9..da8f401 100644 --- a/appmesh/error.go +++ b/appmesh/error.go @@ -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 @@ -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{}) diff --git a/appmesh/sample_apps.go b/appmesh/sample_apps.go index 91c2424..eba3cd2 100644 --- a/appmesh/sample_apps.go +++ b/appmesh/sample_apps.go @@ -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 { @@ -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 }