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

More descriptive errors with specific HTTP return codes #510

Merged
merged 2 commits into from
Aug 11, 2015
Merged

More descriptive errors with specific HTTP return codes #510

merged 2 commits into from
Aug 11, 2015

Conversation

ctennis
Copy link
Contributor

@ctennis ctennis commented Aug 10, 2015

Create a new error class that logical backends can use to specify more concrete error statuses to be returned to the HTTP stack in those cases. For non-changed cases, existing behavior is preserved.

This was inspired by #235 where double mounts caused a 500 error. This is because as you go back down the call chain, it doesn't know how to distinguish errors in client input and operation from backend errors.

This updates this specific case to now return a 409 Conflict instead of a 500 error for this specific case, but other cases can also be tackled as needed. There's at least one other ticket opened for the same type of issue.

ctennis added 2 commits August 9, 2015 15:20
specify more concrete error cases to make their way back up the stack.

Over time there is probably a cleaner way of doing this, but that's
looking like a more massive rewrite and this solves some issues in
the meantime.

Use a CodedError to return a more concrete HTTP return code for
operations you want to do so.  Returning a regular error leaves
the existing behavior in place.
@armon
Copy link
Member

armon commented Aug 11, 2015

@ctennis Looks great, thanks!

armon added a commit that referenced this pull request Aug 11, 2015
More descriptive errors with specific HTTP return codes
@armon armon merged commit be88630 into hashicorp:master Aug 11, 2015
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