Skip to content

Commit 90d9a97

Browse files
author
sofia
committed
added new error for specific error code
1 parent 3aa9be0 commit 90d9a97

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/intercom/errors.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ class ServiceConnectionError < IntercomError; end
4141

4242
# Raised when requesting resources on behalf of a user that doesn't exist in your application on Intercom.
4343
class ResourceNotFound < IntercomError; end
44-
44+
45+
# Raised when trying to create a resource that already exists in Intercom.
46+
class ResourceNotUniqueError < IntercomError; end
47+
4548
# Raised when the request has bad syntax
4649
class BadRequestError < IntercomError; end
4750

lib/intercom/request.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ def raise_application_errors_on_failure(error_list_details, http_code)
163163
raise Intercom::ServiceUnavailableError.new(error_details['message'], error_context)
164164
when 'conflict', 'unique_user_constraint'
165165
raise Intercom::MultipleMatchingUsersError.new(error_details['message'], error_context)
166+
when 'resource_conflict'
167+
raise Intercom::ResourceNotUniqueError.new(error_details['message'], error_context)
166168
when nil, ''
167169
raise Intercom::UnexpectedError.new(message_for_unexpected_error_without_type(error_details, parsed_http_code), error_context)
168170
else

0 commit comments

Comments
 (0)