Skip to content

Commit c62d700

Browse files
authored
Revert "refactor error handling" (#558)
1 parent a1bbff4 commit c62d700

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/intercom/request.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@ def execute(target_base_url = nil, token:, read_timeout: 90, open_timeout: 30, a
158158
private def raise_errors_on_failure(res)
159159
code = res.code.to_i
160160

161-
if code == 429
161+
if code == 404
162+
raise Intercom::ResourceNotFound, 'Resource Not Found'
163+
elsif code == 401
164+
raise Intercom::AuthenticationError, 'Unauthorized'
165+
elsif code == 403
166+
raise Intercom::AuthenticationError, 'Forbidden'
167+
elsif code == 429
162168
raise Intercom::RateLimitExceeded, 'Rate Limit Exceeded'
163169
elsif code == 500
164170
raise Intercom::ServerError, 'Server Error'

0 commit comments

Comments
 (0)