Exception: CemAcpt::Bolt::BoltActionError
- Inherits:
-
StandardError
- Object
- StandardError
- CemAcpt::Bolt::BoltActionError
- Defined in:
- lib/cem_acpt/bolt/errors.rb
Overview
Class for general Bolt errors. Can also wrap other errors.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#bolt_action ⇒ Object
readonly
Returns the value of attribute bolt_action.
-
#bolt_object ⇒ Object
readonly
Returns the value of attribute bolt_object.
-
#original_error ⇒ Object
readonly
Returns the value of attribute original_error.
Instance Method Summary collapse
- #bolt_target ⇒ Object
-
#initialize(msg = 'Bolt error occured', original_error = nil, bolt_action = nil, bolt_object = nil) ⇒ BoltActionError
constructor
A new instance of BoltActionError.
- #to_h ⇒ Object
Constructor Details
#initialize(msg = 'Bolt error occured', original_error = nil, bolt_action = nil, bolt_object = nil) ⇒ BoltActionError
Returns a new instance of BoltActionError.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cem_acpt/bolt/errors.rb', line 9 def initialize(msg = 'Bolt error occured', original_error = nil, bolt_action = nil, bolt_object = nil) @original_error = original_error @bolt_action = bolt_action @bolt_object = bolt_object unless @original_error.nil? set_backtrace(@original_error.backtrace) msg = "#{msg}: #{@original_error}" end super(msg) end |
Instance Attribute Details
#bolt_action ⇒ Object (readonly)
Returns the value of attribute bolt_action.
7 8 9 |
# File 'lib/cem_acpt/bolt/errors.rb', line 7 def bolt_action @bolt_action end |
#bolt_object ⇒ Object (readonly)
Returns the value of attribute bolt_object.
7 8 9 |
# File 'lib/cem_acpt/bolt/errors.rb', line 7 def bolt_object @bolt_object end |
#original_error ⇒ Object (readonly)
Returns the value of attribute original_error.
7 8 9 |
# File 'lib/cem_acpt/bolt/errors.rb', line 7 def original_error @original_error end |
Instance Method Details
#bolt_target ⇒ Object
20 21 22 |
# File 'lib/cem_acpt/bolt/errors.rb', line 20 def bolt_target @bolt_target ||= @bolt_object&.target end |
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/cem_acpt/bolt/errors.rb', line 24 def to_h { bolt_action: bolt_action, bolt_object: bolt_object, original_error: original_error, message: , backtrace: backtrace, } end |