Skip to content

Commit

Permalink
Merge pull request #120 from auth0/CLI-46
Browse files Browse the repository at this point in the history
[CLI-46] updated error messages for apps command
  • Loading branch information
Widcket authored Mar 3, 2021
2 parents 3faabc9 + 399bb77 commit 2f2efd1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Lists your existing applications. To create one try:
})

if err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}

cli.renderer.ApplicationList(list.Clients)
Expand Down Expand Up @@ -87,10 +87,10 @@ auth0 apps show <id>
input := prompt.TextInput(appID, "Id:", "Id of the application.", true)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
} else {
return errors.New("missing application id")
return errors.New("Please provide an application id")
}
} else {
inputs.ID = args[0]
Expand All @@ -105,7 +105,7 @@ auth0 apps show <id>
})

if err != nil {
return err
return fmt.Errorf("Unable to load application. The id %v specified doesn't exist", inputs.ID)
}

revealClientSecret := auth0.StringValue(a.AppType) != "native" && auth0.StringValue(a.AppType) != "spa"
Expand Down Expand Up @@ -139,10 +139,10 @@ auth0 apps delete <id>
input := prompt.TextInput(appID, "Id:", "Id of the application.", true)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
} else {
return errors.New("missing application id")
return errors.New("Please provide an application id")
}
} else {
inputs.ID = args[0]
Expand Down Expand Up @@ -190,7 +190,7 @@ auth0 apps create --name myapp --type [native|spa|regular|m2m]
true)

if err := prompt.AskOne(input, &flags); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

Expand All @@ -206,15 +206,15 @@ auth0 apps create --name myapp --type [native|spa|regular|m2m]
true)

if err := prompt.AskOne(input, &flags); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

if shouldPrompt(cmd, appDescription) {
input := prompt.TextInput(appDescription, "Description:", "Description of the application.", false)

if err := prompt.AskOne(input, &flags); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

Expand All @@ -231,7 +231,7 @@ auth0 apps create --name myapp --type [native|spa|regular|m2m]
})

if err != nil {
return err
return fmt.Errorf("Unable to create application: %w", err)
}

// note: c is populated with the rest of the client fields by the API during creation.
Expand Down Expand Up @@ -283,10 +283,10 @@ auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
input := prompt.TextInput(appID, "Id:", "Id of the application.", true)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
} else {
return errors.New("missing application id")
return errors.New("Please provide an application id")
}
} else {
inputs.ID = args[0]
Expand All @@ -296,7 +296,7 @@ auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
input := prompt.TextInput(appName, "Name:", "Name of the application", true)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

Expand All @@ -312,15 +312,15 @@ auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
true)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

if shouldPrompt(cmd, appDescription) {
input := prompt.TextInput(appDescription, "Description:", "Description of the application.", false)

if err := prompt.AskOne(input, &inputs); err != nil {
return err
return fmt.Errorf("An unexpected error occurred: %w", err)
}
}

Expand All @@ -337,7 +337,7 @@ auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
})

if err != nil {
return err
return fmt.Errorf("Unable to update application %v: %v", inputs.ID, err)
}

// note: c is populated with the rest of the client fields by the API during creation.
Expand Down

0 comments on commit 2f2efd1

Please sign in to comment.