Exception: Logan::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Logan::Error
- Defined in:
- lib/logan/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(code, message) ⇒ Error
constructor
A new instance of Error.
- #to_json ⇒ Object
Constructor Details
#initialize(code, message) ⇒ Error
Returns a new instance of Error.
6 7 8 9 |
# File 'lib/logan/errors.rb', line 6 def initialize(code, ) @code = code.to_sym @message = end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/logan/errors.rb', line 3 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/logan/errors.rb', line 4 def @message end |
Instance Method Details
#to_json ⇒ Object
11 12 13 |
# File 'lib/logan/errors.rb', line 11 def to_json JSON.generate({error: @code.to_s, error_description: @message}) end |