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, UnprocessableContentError
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
51 52 53 54 55 56 |
# File 'lib/dor/services/client.rb', line 51 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
59 60 61 |
# File 'lib/dor/services/client.rb', line 59 def errors @errors end |
#graphql_errors ⇒ Object
rubocop:enable Lint/MissingSuper
59 60 61 |
# File 'lib/dor/services/client.rb', line 59 def graphql_errors @graphql_errors end |
Instance Method Details
#to_s ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/dor/services/client.rb', line 61 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 |