Exception: JPie::Errors::Error
- Inherits:
-
StandardError
- Object
- StandardError
- JPie::Errors::Error
- Defined in:
- lib/jpie/errors.rb
Direct Known Subclasses
BadRequestError, ForbiddenError, InternalServerError, NotFoundError, ResourceError, UnauthorizedError, UnsupportedMediaTypeError, ValidationError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(status:, code: nil, title: nil, detail: nil, source: nil) ⇒ Error
constructor
A new instance of Error.
- #to_hash ⇒ Object
Constructor Details
#initialize(status:, code: nil, title: nil, detail: nil, source: nil) ⇒ Error
Returns a new instance of Error.
8 9 10 11 12 13 14 15 |
# File 'lib/jpie/errors.rb', line 8 def initialize(status:, code: nil, title: nil, detail: nil, source: nil) @status = status @code = code @title = title @detail = detail @source = source super(detail || title || 'An error occurred') end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
6 7 8 |
# File 'lib/jpie/errors.rb', line 6 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
6 7 8 |
# File 'lib/jpie/errors.rb', line 6 def detail @detail end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/jpie/errors.rb', line 6 def source @source end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/jpie/errors.rb', line 6 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/jpie/errors.rb', line 6 def title @title end |
Instance Method Details
#to_hash ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/jpie/errors.rb', line 17 def to_hash { status: status.to_s, code:, title:, detail:, source: }.compact end |