Skip to content

Commit a12d7c9

Browse files
committed
refactor error handling
1 parent 5f24883 commit a12d7c9

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/intercom/request.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,7 @@ 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 == 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
161+
if code ==429
168162
raise Intercom::RateLimitExceeded, 'Rate Limit Exceeded'
169163
elsif code == 500
170164
raise Intercom::ServerError, 'Server Error'

0 commit comments

Comments
 (0)