Skip to content

Commit

Permalink
update meshkit errors
Browse files Browse the repository at this point in the history
Signed-off-by: MUzairS15 <muzair.shaikh810@gmail.com>
  • Loading branch information
MUzairS15 committed Jul 7, 2023
1 parent 77a2b90 commit 000fcaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 6 additions & 4 deletions utils/component/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
}
4 changes: 1 addition & 3 deletions utils/component/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 000fcaa

Please sign in to comment.