Exception: Mindee::Errors::MindeeHTTPErrorV2
- Inherits:
-
MindeeError
- Object
- StandardError
- MindeeError
- Mindee::Errors::MindeeHTTPErrorV2
- Defined in:
- lib/mindee/errors/mindee_http_error_v2.rb
Overview
API V2 HttpError
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
A machine-readable code specific to the occurrence of the problem.
-
#detail ⇒ String
readonly
A human-readable explanation specific to the occurrence of the problem.
-
#errors ⇒ Array<ErrorItem>
readonly
A list of explicit error details.
-
#status ⇒ Integer
readonly
The HTTP status code returned by the server.
-
#title ⇒ String
readonly
A short, human-readable summary of the problem.
Instance Method Summary collapse
-
#initialize(http_error) ⇒ MindeeHTTPErrorV2
constructor
A new instance of MindeeHTTPErrorV2.
Constructor Details
#initialize(http_error) ⇒ MindeeHTTPErrorV2
Returns a new instance of MindeeHTTPErrorV2.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 22 def initialize(http_error) if http_error.is_a?(Parsing::V2::ErrorResponse) http_error = { 'detail' => http_error.detail, 'status' => http_error.status, 'title' => http_error.title, 'code' => http_error.code, 'errors' => http_error.errors } end @status = http_error['status'] @detail = http_error['detail'] @title = http_error['title'] @code = http_error['code'] @errors = if http_error.key?('errors') http_error['errors'].map do |error| Parsing::V2::ErrorItem.new(error) end else [] end super("HTTP #{@status} - #{@title} :: #{@code} - #{@detail}") end |
Instance Attribute Details
#code ⇒ String (readonly)
Returns A machine-readable code specific to the occurrence of the problem.
17 18 19 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 17 def code @code end |
#detail ⇒ String (readonly)
Returns A human-readable explanation specific to the occurrence of the problem.
13 14 15 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 13 def detail @detail end |
#errors ⇒ Array<ErrorItem> (readonly)
Returns A list of explicit error details.
19 20 21 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 19 def errors @errors end |
#status ⇒ Integer (readonly)
Returns The HTTP status code returned by the server.
11 12 13 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 11 def status @status end |
#title ⇒ String (readonly)
Returns A short, human-readable summary of the problem.
15 16 17 |
# File 'lib/mindee/errors/mindee_http_error_v2.rb', line 15 def title @title end |