Exception: EtCcdClient::Exceptions::UnprocessableEntity
- Defined in:
- lib/et_ccd_client/exceptions/unprocessable_entity.rb
Instance Attribute Summary
Attributes inherited from Base
#original_exception, #request, #url
Instance Method Summary collapse
Methods inherited from Base
exception, #initialize, raise_exception, #response
Constructor Details
This class inherits a constructor from EtCcdClient::Exceptions::Base
Instance Method Details
#to_s ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/et_ccd_client/exceptions/unprocessable_entity.rb', line 4 def to_s json = JSON.parse(response.body) rescue JSON::JSONError return super if json.nil? || json == JSON::JSONError field_errors = json.dig('details', 'field_errors')&.map do |field_error| "#{field_error['id']} => #{field_error['message']}" end return super if field_errors.nil? "#{super} - #{field_errors.join(', ')}" end |