Skip to content

Commit 8a4bc88

Browse files
author
Kevin Antoine
authored
Merge pull request #337 from intercom/AK/raise-AuthenticationError-on-invalid-token
raise unauthorizedError on invalid token
2 parents 8918026 + 91b727f commit 8a4bc88

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/intercom/errors.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def to_hash
2323
end
2424
end
2525

26-
# Raised when the credentials you provide don't match a valid account on Intercom.
27-
# Check that you have set <b>Intercom.app_id=</b> and <b>Intercom.app_api_key=</b> correctly.
26+
# Raised when the token you provided is incorrect or not authorized to access certain type of data.
27+
# Check that you have set Intercom.token correctly.
2828
class AuthenticationError < IntercomError; end
2929

3030
# Raised when something goes wrong on within the Intercom API service.

lib/intercom/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def raise_application_errors_on_failure(error_list_details, http_code)
139139
:request_id => error_list_details['request_id']
140140
}
141141
case error_code
142-
when 'unauthorized', 'forbidden'
142+
when 'unauthorized', 'forbidden', 'token_not_found'
143143
raise Intercom::AuthenticationError.new(error_details['message'], error_context)
144144
when "bad_request", "missing_parameter", 'parameter_invalid', 'parameter_not_found'
145145
raise Intercom::BadRequestError.new(error_details['message'], error_context)

0 commit comments

Comments
 (0)