lib/intercom/request.rb in intercom-3.5.4 vs lib/intercom/request.rb in intercom-3.5.5
- old
+ new
@@ -126,13 +126,16 @@
def raise_application_errors_on_failure(error_list_details, http_code)
# Currently, we don't support multiple errors
error_details = error_list_details['errors'].first
error_code = error_details['type'] || error_details['code']
+ error_field = error_details['field']
parsed_http_code = (http_code > 0 ? http_code : nil)
error_context = {
:http_code => parsed_http_code,
- :application_error_code => error_code
+ :application_error_code => error_code,
+ :field => error_field,
+ :request_id => error_list_details['request_id']
}
case error_code
when 'unauthorized', 'forbidden'
raise Intercom::AuthenticationError.new(error_details['message'], error_context)
when "bad_request", "missing_parameter", 'parameter_invalid', 'parameter_not_found'