Class: CemAcpt::ErrorActionResult
- Inherits:
-
Object
- Object
- CemAcpt::ErrorActionResult
- Defined in:
- lib/cem_acpt/action_result.rb
Overview
Wrapper class for an error raised during an action.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(error) ⇒ ErrorActionResult
constructor
A new instance of ErrorActionResult.
- #inspect ⇒ Object
- #results ⇒ Object
- #results? ⇒ Boolean
- #status ⇒ Object (also: #http_status)
- #success? ⇒ Boolean
- #summary ⇒ Object
- #summary? ⇒ Boolean
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(error) ⇒ ErrorActionResult
Returns a new instance of ErrorActionResult.
42 43 44 |
# File 'lib/cem_acpt/action_result.rb', line 42 def initialize(error) @error = error end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
40 41 42 |
# File 'lib/cem_acpt/action_result.rb', line 40 def error @error end |
Instance Method Details
#error? ⇒ Boolean
46 47 48 |
# File 'lib/cem_acpt/action_result.rb', line 46 def error? true end |
#inspect ⇒ Object
58 59 60 |
# File 'lib/cem_acpt/action_result.rb', line 58 def inspect to_s end |
#results ⇒ Object
75 76 77 |
# File 'lib/cem_acpt/action_result.rb', line 75 def results @error.backtrace end |
#results? ⇒ Boolean
79 80 81 |
# File 'lib/cem_acpt/action_result.rb', line 79 def results? true end |
#status ⇒ Object Also known as: http_status
70 71 72 |
# File 'lib/cem_acpt/action_result.rb', line 70 def status 1 end |
#success? ⇒ Boolean
50 51 52 |
# File 'lib/cem_acpt/action_result.rb', line 50 def success? false end |
#summary ⇒ Object
83 84 85 |
# File 'lib/cem_acpt/action_result.rb', line 83 def summary @error. end |
#summary? ⇒ Boolean
87 88 89 |
# File 'lib/cem_acpt/action_result.rb', line 87 def summary? true end |
#to_h ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/cem_acpt/action_result.rb', line 62 def to_h { class: @error.class.name, message: @error., backtrace: @error.backtrace, } end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/cem_acpt/action_result.rb', line 54 def to_s "#<#{@error.class.name}:0x#{@error.object_id.to_s(16)}>" end |