class EtCcdClient::Exceptions::UnprocessableEntity
Public Instance Methods
to_s()
click to toggle source
Calls superclass method
EtCcdClient::Exceptions::Base#to_s
# 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