Exception: ACE::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- ACE::Error
- Defined in:
- lib/ace/error.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#issue_code ⇒ Object
readonly
Returns the value of attribute issue_code.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(msg, kind, details = nil, issue_code = nil) ⇒ Error
constructor
A new instance of Error.
- #msg ⇒ Object
- #to_h ⇒ Object
- #to_json(opts = nil) ⇒ Object
Constructor Details
#initialize(msg, kind, details = nil, issue_code = nil) ⇒ Error
Returns a new instance of Error.
7 8 9 10 11 12 13 |
# File 'lib/ace/error.rb', line 7 def initialize(msg, kind, details = nil, issue_code = nil) super(msg) @kind = kind @issue_code = issue_code @details = details || {} @error_code ||= 1 end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/ace/error.rb', line 5 def details @details end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
5 6 7 |
# File 'lib/ace/error.rb', line 5 def error_code @error_code end |
#issue_code ⇒ Object (readonly)
Returns the value of attribute issue_code.
5 6 7 |
# File 'lib/ace/error.rb', line 5 def issue_code @issue_code end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
5 6 7 |
# File 'lib/ace/error.rb', line 5 def kind @kind end |
Class Method Details
.to_h(message, kind, details = nil, issue_code = nil) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/ace/error.rb', line 27 def self.to_h(, kind, details = nil, issue_code = nil) h = { 'kind' => kind, 'msg' => , 'details' => details } h['issue_code'] = issue_code if issue_code h end |
Instance Method Details
#msg ⇒ Object
15 16 17 |
# File 'lib/ace/error.rb', line 15 def msg end |
#to_h ⇒ Object
19 20 21 |
# File 'lib/ace/error.rb', line 19 def to_h Error.to_h(msg, kind, details, issue_code) end |
#to_json(opts = nil) ⇒ Object
23 24 25 |
# File 'lib/ace/error.rb', line 23 def to_json(opts = nil) to_h.to_json(opts) end |