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

Provide error handling for when the directory can't be deleted #492

Merged
merged 1 commit into from Nov 1, 2019

Conversation

jcoyne
Copy link
Contributor

@jcoyne jcoyne commented Nov 1, 2019

Why was this change made?

Better errors when a directory can't be deleted.

Was the API documentation (openapi.json) updated?

n/a

Copy link
Member

@mjgiarlo mjgiarlo left a comment

Choose a reason for hiding this comment

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

Have a question about breaking out multiple rescues vs. lumping them together.

@@ -23,6 +23,8 @@ def destroy
head :no_content
rescue Errno::ENOENT => e
render build_error('Unable to remove directory', e)
rescue Errno::ENOTEMPTY => e
Copy link
Member

Choose a reason for hiding this comment

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

Not important, but since the behavior/message is the same on lines 25 and 27, I'm curious why you didn't do:

rescue Errno::ENOENT, Errno::ENOTEMPTY => e
  render build_error('Unable to remove directory', e)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was hoping rubocop would do it for me. 😆

Copy link
Member

Choose a reason for hiding this comment

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

typical rubocop

@mjgiarlo mjgiarlo merged commit 02069ab into master Nov 1, 2019
@mjgiarlo mjgiarlo deleted the better-errors2 branch November 1, 2019 15:58
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.

None yet

2 participants