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

respond to client errors with 400 range responses rather than 500 #2

Open
jedgalbraith opened this issue Sep 19, 2017 · 4 comments
Open
Assignees

Comments

@jedgalbraith
Copy link

jedgalbraith commented Sep 19, 2017

Would it be possible to respond to errors that are a result of client/user provided data with 400 range statuses rather than 500? That way Odin can handle them differently. For example:

500:{
  "errors": [
    "Your IP (...) is not authorized to use this API key"
  ]
}

Currently that error indicates to Odin that something malfunctioned within the adapter because of the 500 status, when really it was just a user setting causing the error.

@danhunsaker
Copy link
Contributor

Most errors are reported from Libcloud by throwing a generic LibcloudError with the message, and no other way to distinguish the cause than parsing the message itself, which varies between providers. So it's probably doable, but it might take a while to rework the system to support it properly. I'll start working on that as soon as I need a break from the Azure RM adapter, since I've already started in on that one.

@jedgalbraith
Copy link
Author

jedgalbraith commented Sep 19, 2017

Oh, that's a bummer. I was hoping there would be a more straight forward way of distinguishing the cause. I don't know if it's worth it then. With other adapters, I was able to base it on the status of the response from the provider's API.

@danhunsaker
Copy link
Contributor

Yeah, if I was talking to them directly, I'd be able to handle things more intelligently myself, too. Still, I'm a firm believer in RESTful API design, and that means labeling user errors as what they are, so I'm still going to figure this one out.

@jedgalbraith
Copy link
Author

Ok. Thanks. Good luck! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants