Exception: Apia::ManifestError
- Inherits:
-
StandardError
- Object
- StandardError
- StandardError
- Apia::ManifestError
- Defined in:
- lib/apia/errors/manifest_error.rb
Instance Method Summary collapse
- #detail ⇒ Object
- #errors ⇒ Object
-
#initialize(errors) ⇒ ManifestError
constructor
A new instance of ManifestError.
- #to_s ⇒ Object
- #triplet ⇒ Object
Constructor Details
#initialize(errors) ⇒ ManifestError
Returns a new instance of ManifestError.
8 9 10 |
# File 'lib/apia/errors/manifest_error.rb', line 8 def initialize(errors) @errors = errors end |
Instance Method Details
#detail ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/apia/errors/manifest_error.rb', line 24 def detail @errors.errors.map do |object, errors| { object: object.id, errors: errors.map do |error| { code: error[:code], description: error[:message] } end } end end |
#errors ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/apia/errors/manifest_error.rb', line 16 def errors @errors.errors.each_with_object([]) do |(object, errors), array| errors.each do |error| array << "#{object.id}: #{error[:code]} (#{error[:message]})" end end.join(', ') end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/apia/errors/manifest_error.rb', line 12 def to_s "#{@errors.errors.size} object(s) have issues that need attention (#{errors})" end |
#triplet ⇒ Object
38 39 40 |
# File 'lib/apia/errors/manifest_error.rb', line 38 def triplet Rack.error_triplet('manifest_error', description: 'An issue exists with the API manifest that needs resolving by the developer.', detail: detail) end |