Skip to content

Commit

Permalink
Add 403 code to the list of status errors hash
Browse files Browse the repository at this point in the history
  • Loading branch information
juankiz committed May 7, 2024
1 parent ece1a9f commit c3ca17f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/easy_meli/error_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class EasyMeli::ErrorParser

STATUS_ERRORS = {
401 => EasyMeli::InvalidTokenError,
403 => EasyMeli::ForbiddenError,
500 => EasyMeli::InternalServerError,
501 => EasyMeli::NotImplementedError,
502 => EasyMeli::BadGatewayError,
Expand Down
5 changes: 5 additions & 0 deletions test/error_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def test_status_error_class

assert_equal EasyMeli::InvalidTokenError, EasyMeli::ErrorParser.status_error_class(response)

response = mock
response.stubs(code: 403)

assert_equal EasyMeli::ForbiddenError, EasyMeli::ErrorParser.status_error_class(response)

response.stubs(code: 200)

assert_nil EasyMeli::ErrorParser.status_error_class(response)
Expand Down

0 comments on commit c3ca17f

Please sign in to comment.