Skip to content

Commit c3ca17f

Browse files
committed
Add 403 code to the list of status errors hash
1 parent ece1a9f commit c3ca17f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/easy_meli/error_parser.rb

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class EasyMeli::ErrorParser
1212

1313
STATUS_ERRORS = {
1414
401 => EasyMeli::InvalidTokenError,
15+
403 => EasyMeli::ForbiddenError,
1516
500 => EasyMeli::InternalServerError,
1617
501 => EasyMeli::NotImplementedError,
1718
502 => EasyMeli::BadGatewayError,

test/error_parser_test.rb

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def test_status_error_class
3434

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

37+
response = mock
38+
response.stubs(code: 403)
39+
40+
assert_equal EasyMeli::ForbiddenError, EasyMeli::ErrorParser.status_error_class(response)
41+
3742
response.stubs(code: 200)
3843

3944
assert_nil EasyMeli::ErrorParser.status_error_class(response)

0 commit comments

Comments
 (0)