From 000fcaa539470247696616aeba5707fadbe0343a Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Fri, 7 Jul 2023 19:24:50 +0530 Subject: [PATCH] update meshkit errors Signed-off-by: MUzairS15 --- utils/component/error.go | 10 ++++++---- utils/component/generator.go | 4 +--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/utils/component/error.go b/utils/component/error.go index 65cd854d..a79c6d61 100644 --- a/utils/component/error.go +++ b/utils/component/error.go @@ -9,18 +9,20 @@ const ( ErrUpdateSchemaCode = "11092" ) +// No reference usage found. Also check in adapters before deleting func ErrCrdGenerate(err error) error { - return errors.New(ErrCrdGenerateCode, errors.Alert, []string{"Could not generate component with the given CRD"}, []string{err.Error()}, []string{""}, []string{"Make sure that the crds provided are all valid YAML"}) + return errors.New(ErrCrdGenerateCode, errors.Alert, []string{"Could not generate component with the given CRD"}, []string{err.Error()}, []string{""}, []string{"Verify CRD has valid schema."}) } +// No reference usage found. Also check in adapters before deleting func ErrGetDefinition(err error) error { - return errors.New(ErrDefinitionCode, errors.Alert, []string{"Could not get definition for the given CRD"}, []string{err.Error()}, []string{""}, []string{"Make sure that the given CRD is valid"}) + return errors.New(ErrDefinitionCode, errors.Alert, []string{"Could not get definition for the given CRD"}, []string{err.Error()}, []string{""}, []string{"Verify CRD has valid schema."}) } func ErrGetSchema(err error) error { - return errors.New(ErrGetSchemaCode, errors.Alert, []string{"Could not get schema for the given CRD"}, []string{err.Error()}, []string{""}, []string{"Make sure that the given CRD is valid"}) + return errors.New(ErrGetSchemaCode, errors.Alert, []string{"Could not get schema for the given CRD"}, []string{err.Error()}, []string{"Unable to marshal from cue value to valid JSON", "Unable to unmarshal from JSON to Go type"}, []string{"Verify CRD has valid schema.", "Malformed JSON", "CUE path to propery doesn't exist"}) } func ErrUpdateSchema(err error, obj string) error { - return errors.New(ErrUpdateSchemaCode, errors.Alert, []string{"Failed to update schema properties ", obj}, []string{err.Error()}, []string{}, []string{"Verify CRD has valid schema"}) + return errors.New(ErrUpdateSchemaCode, errors.Alert, []string{"Failed to update schema properties for ", obj}, []string{err.Error()}, []string{"Incorrect type assertion", "Selector.Unquoted might have been invoked on non-string label", "error during conversion from cue.Selector to string"}, []string{"Ensure correct type assertion", "Perform appropriate conversion from cue.Selector to string","Verify CRD has valid schema"}) } diff --git a/utils/component/generator.go b/utils/component/generator.go index d9958ba9..7202ab60 100644 --- a/utils/component/generator.go +++ b/utils/component/generator.go @@ -127,9 +127,7 @@ func UpdateProperties(fieldVal cue.Value, cuePath cue.Path, group string) (map[s } }) - /* - "pathSelectors" contains all the paths from root to the property which needs to be modified. - */ + // "pathSelectors" contains all the paths from root to the property which needs to be modified. for _, selectors := range pathSelectors { var m interface{} m = modified