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

Use error message from Sony Ci api http response body for SonyCiApi::HttpError #2

Open
afred opened this issue Aug 26, 2021 · 0 comments
Assignees

Comments

@afred
Copy link
Contributor

afred commented Aug 26, 2021

Because

For SonyCiApi::HttpError, which wraps Faraday::Error, it is currently fetching the error message from the Faraday::Error object, which is generic, e.g. "there was a problem and the server returned status 400", or something like that.

Meanwhile, the real error is embedded in Faraday::Error#response['body'] which is a JSON string. Once parsed, a better error message can be found.

NOTE: Sony Ci puts the error message under a couple different properties. One of them is either error or error_messge, or maybe it's error.message? I don't recall off hand, but I think this is the most common one. But another one place they put it is in error_description, so it will take some trial and error to figure out where the error messages are stashed. If we miss one, then we should fallback to the Faraday::Error#message value.

Done when

  1. SonyCiApi::HttpErro#message returns the error message contained within the Sony Ci api http response, which is in the Faraday::Error#response, if present.
  2. if not present, then falls back to the value of Faraday::Error#message
@afred afred self-assigned this Sep 13, 2021
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

No branches or pull requests

1 participant