Module: Apish::Error
- Defined in:
- lib/apish/error.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/apish/error.rb', line 3 def @message end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/apish/error.rb', line 3 def type @type end |
Instance Method Details
#initialize(message_or_error) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/apish/error.rb', line 5 def initialize( ) if .is_a?( Exception ) @message = . @type = .class.name else @message = @type = 'Exception' end end |
#to_json ⇒ Object
15 16 17 |
# File 'lib/apish/error.rb', line 15 def to_json { root => body }.to_json end |
#to_xml ⇒ Object
19 20 21 |
# File 'lib/apish/error.rb', line 19 def to_xml body.to_xml :root => root end |