Exception: CuvvaError
- Inherits:
-
StandardError
- Object
- StandardError
- CuvvaError
- Defined in:
- lib/cuvva_error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#meta ⇒ Object
Returns the value of attribute meta.
-
#reasons ⇒ Object
Returns the value of attribute reasons.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#initialize(*args) ⇒ CuvvaError
constructor
A new instance of CuvvaError.
- #to_hash ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ CuvvaError
Returns a new instance of CuvvaError.
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cuvva_error.rb', line 7 def initialize(*args) code, reasons, = args if === nil && !reasons.is_a?(Array) = reasons reasons = nil end @code = code @reasons = reasons @meta = @stack = caller end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
2 3 4 |
# File 'lib/cuvva_error.rb', line 2 def code @code end |
#meta ⇒ Object
Returns the value of attribute meta.
4 5 6 |
# File 'lib/cuvva_error.rb', line 4 def @meta end |
#reasons ⇒ Object
Returns the value of attribute reasons.
3 4 5 |
# File 'lib/cuvva_error.rb', line 3 def reasons @reasons end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
5 6 7 |
# File 'lib/cuvva_error.rb', line 5 def stack @stack end |
Instance Method Details
#to_hash ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/cuvva_error.rb', line 21 def to_hash { code: self.code, reasons: self.reasons ? self.reasons.to_hash : nil, meta: self. ? self..to_hash : nil, } end |
#to_json(*args) ⇒ Object
29 30 31 |
# File 'lib/cuvva_error.rb', line 29 def to_json(*args) to_hash.to_json(*args) end |