Skip to content

Commit bd3083b

Browse files
author
Kevin Antoine
authored
Merge pull request #338 from intercom/AK/blocked-users
better error message when tryign to restore a blocked user
2 parents 8a4bc88 + 96ddabb commit bd3083b

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/intercom/errors.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class UnexpectedError < IntercomError; end
5454
# Raised when multiple users match the query (typically duplicate email addresses)
5555
class MultipleMatchingUsersError < IntercomError; end
5656

57+
# Raised when restoring a blocked user
58+
class BlockedUserError < IntercomError ; end
59+
5760
# Raised when you try to call a non-setter method that does not exist on an object
5861
class Intercom::AttributeNotSetError < IntercomError ; end
5962

@@ -71,4 +74,5 @@ class IntercomInternalError < StandardError; end
7174
class Intercom::NoMethodMissingHandler < IntercomInternalError; end
7275

7376
class Intercom::DeserializationError < IntercomInternalError; end
77+
7478
end

lib/intercom/request.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ def raise_application_errors_on_failure(error_list_details, http_code)
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)
146+
when "not_restorable"
147+
raise Intercom::BlockedUser.new(error_details['message'], error_context)
146148
when "not_found"
147149
raise Intercom::ResourceNotFound.new(error_details['message'], error_context)
148150
when "rate_limit_exceeded"

0 commit comments

Comments
 (0)