Skip to content

Commit

Permalink
pull latest changes
Browse files Browse the repository at this point in the history
Signed-off-by: Eti Ijeoma <ijayeti@gmail.com>
  • Loading branch information
Aijeyomah committed Oct 11, 2024
1 parent 598f120 commit a617ad4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/kanvas-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ var generateKanvasSnapshotCmd = &cobra.Command{
designName = ExtractNameFromURI(chartURI)
Log.Warnf("No design name provided. Using extracted name: %s", designName)
}

if email != "" && !isValidEmail(email) {
handleError(errors.ErrInvalidEmailFormat(email))
}
// Create Meshery Snapshot
designID, err := CreateMesheryDesign(chartURI, designName, email)
if err != nil {
Expand Down
9 changes: 9 additions & 0 deletions internal/errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ func ErrUnexpectedResponseCode(statusCode int, body string) error {
)
}

func ErrRequiredFieldNotProvided(err error, field string) error {
return errors.New(ErrRequiredFieldNotProvidedCode, errors.Alert,
[]string{"All required flags are not passed."},
[]string{err.Error()},
[]string{"Required flag \"%s\" is not passed."},
[]string{"Ensure value for flag \"%s\" is correctly provided."},
)
}

func ErrInvalidEmailFormat(email string) error {
return errors.New(ErrInvalidEmailFormatCode, errors.Alert,
[]string{"Invalid email format provided."},
Expand Down

0 comments on commit a617ad4

Please sign in to comment.