Exception: Ponto::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Ponto::Error
- Defined in:
- lib/ponto/error.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(errors) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(errors) ⇒ Error
Returns a new instance of Error.
5 6 7 |
# File 'lib/ponto/error.rb', line 5 def initialize(errors) @errors = errors end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
3 4 5 |
# File 'lib/ponto/error.rb', line 3 def errors @errors end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ponto/error.rb', line 9 def to_s if @errors && @errors.size > 0 @errors.map do |error| p error if error["meta"] && error["meta"]["attribute"] "* #{error["code"]}: '#{error["meta"]["attribute"]}' #{error["detail"]}" elsif error["meta"] && error["meta"]["resource"] "* #{error["code"]}: '#{error["meta"]["resource"]}' #{error["detail"]}" else "* #{error["code"]}: #{error["detail"]}" end end.join("\n") else super end end |