Exception: CuvvaError
- Inherits:
-
StandardError
- Object
- StandardError
- CuvvaError
- Defined in:
- lib/cuvva_error.rb
Constant Summary collapse
- @@http_status_map =
{ }
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ CuvvaError
constructor
A new instance of CuvvaError.
- #to_json ⇒ Object
Constructor Details
#initialize(*args) ⇒ CuvvaError
Returns a new instance of CuvvaError.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cuvva_error.rb', line 12 def initialize(*args) code, reasons, = args if === nil && !reasons.is_a?(Array) = reasons reasons = nil end @code = code @reasons = reasons = @stack = caller @http_status = CuvvaError.http_status_map.has_key?(code) ? CuvvaError.http_status_map[code] : 500 end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/cuvva_error.rb', line 6 def code @code end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
10 11 12 |
# File 'lib/cuvva_error.rb', line 10 def http_status @http_status end |
#meta ⇒ Object
Returns the value of attribute meta.
8 9 10 |
# File 'lib/cuvva_error.rb', line 8 def end |
#reasons ⇒ Object
Returns the value of attribute reasons.
7 8 9 |
# File 'lib/cuvva_error.rb', line 7 def reasons @reasons end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
9 10 11 |
# File 'lib/cuvva_error.rb', line 9 def stack @stack end |
Class Method Details
.http_status_map ⇒ Object
33 34 35 |
# File 'lib/cuvva_error.rb', line 33 def self.http_status_map @@http_status_map end |
Instance Method Details
#to_json ⇒ Object
29 30 31 |
# File 'lib/cuvva_error.rb', line 29 def to_json JSON.generate(to_hash) end |