Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLI-122] throw an error for delete commands if item doesn't exit #239

Merged
merged 5 commits into from
Apr 9, 2021

Conversation

bright-poku
Copy link
Contributor

Description

This PR allows the delete commands for apis, apps and rules to return an error if item doesn't exit
as shown below

Screen Shot 2021-04-09 at 1 29 22 PM

References

https://auth0team.atlassian.net/browse/CLI-122

Testing

Describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Also include details of the environment this PR was developed in (language/platform/browser version).

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • [X ] The correct base branch is being used, if not master

Copy link
Contributor

@Widcket Widcket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's reuse the same spinner, like so:

	return ansi.Spinner("Deleting Application", func() error {
		_, err := cli.api.Client.Read(inputs.ID)

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

		return cli.api.Client.Delete(inputs.ID)
	})

@bright-poku
Copy link
Contributor Author

bright-poku commented Apr 9, 2021

Let's reuse the same spinner, like so:

	return ansi.Spinner("Deleting Application", func() error {
		_, err := cli.api.Client.Read(inputs.ID)

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

		return cli.api.Client.Delete(inputs.ID)
	})

@Widcket thanks. I made the changes

Copy link
Contributor

@Widcket Widcket left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Widcket Widcket merged commit 581baa9 into main Apr 9, 2021
@Widcket Widcket deleted the CLI-122 branch April 9, 2021 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants