-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update Error Classification mechanism #7
Conversation
end | ||
|
||
def test_invalid_token_error | ||
assert_token_error('error' => 'invalid_token') | ||
body = { "message": "invalid_token", "error": "not_found", "status": 401, "cause":[] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the error responses from recorded vcr files, I don't have a vcr for the forbidden error, but we can update it in case the error message is different.
Mercado Libre doesn't have a uniform error structure. For example the invalid_token error has in the error key "not_found" { "message": "invalid_token", "error": "not_found", "status": 401, "cause":[] } Or malformed access_token comes as a bad_request error { "message": "Malformed access_token: test","error": "bad_request", "status": 400, "cause":[] } This updates the error classification mechanism to use the description as the first alternative to classify the error.
544161f
to
aa2077e
Compare
status_error = STATUS_ERRORS[response.code] | ||
raise status_error.new(response) if status_error | ||
def error_message_from_body(response) | ||
return if response.body.nil? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[DEPRECATION] HTTParty will no longer override
response#nil?
. This functionality will be removed in future versions. Please, add explicit checkresponse.body.nil? || response.body.empty?
. For more info refer to: jnunemaker/httparty#568
aa2077e
to
617690c
Compare
@enortham friendly reminder |
Mercado Libre doesn't have a uniform error structure. For example the
invalid_token error has in the error key "not_found"
Or malformed access_token comes as a bad_request error
This updates the error classification mechanism to use the description
as the first alternative to classify the error.