Exception: Dor::Services::Client::UnexpectedResponse
- Defined in:
- lib/dor/services/client.rb
Overview
Error that is raised when the remote server returns some unexpected response this could be any 4xx or 5xx status (except the ones that are direct children of the Error class above)
Direct Known Subclasses
BadRequestError, ConflictResponse, PreconditionFailedResponse, UnauthorizedResponse
Instance Attribute Summary collapse
-
#errors ⇒ Object
rubocop:enable Lint/MissingSuper.
-
#graphql_errors ⇒ Object
rubocop:enable Lint/MissingSuper.
Instance Method Summary collapse
-
#initialize(response:, object_identifier: nil, errors: nil, graphql_errors: nil) ⇒ UnexpectedResponse
constructor
rubocop:disable Lint/MissingSuper.
- #to_s ⇒ Object
Constructor Details
#initialize(response:, object_identifier: nil, errors: nil, graphql_errors: nil) ⇒ UnexpectedResponse
rubocop:disable Lint/MissingSuper
50 51 52 53 54 55 |
# File 'lib/dor/services/client.rb', line 50 def initialize(response:, object_identifier: nil, errors: nil, graphql_errors: nil) @response = response @object_identifier = object_identifier @errors = errors @graphql_errors = graphql_errors end |
Instance Attribute Details
#errors ⇒ Object
rubocop:enable Lint/MissingSuper
58 59 60 |
# File 'lib/dor/services/client.rb', line 58 def errors @errors end |
#graphql_errors ⇒ Object
rubocop:enable Lint/MissingSuper
58 59 60 |
# File 'lib/dor/services/client.rb', line 58 def graphql_errors @graphql_errors end |
Instance Method Details
#to_s ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/dor/services/client.rb', line 60 def to_s # For GraphQL errors, see https://graphql-ruby.org/errors/execution_errors return graphql_errors.map { |e| e['message'] }.join(', ') if graphql_errors.present? return errors.map { |e| "#{e['title']} (#{e['detail']})" }.join(', ') if errors.present? ResponseErrorFormatter.format(response: @response, object_identifier: @object_identifier) end |