Exception: Lite::Command::Fault
- Inherits:
-
StandardError
- Object
- StandardError
- Lite::Command::Fault
- Defined in:
- lib/lite/command/fault.rb
Instance Attribute Summary collapse
-
#caused_by ⇒ Object
readonly
Returns the value of attribute caused_by.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#thrown_by ⇒ Object
readonly
Returns the value of attribute thrown_by.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**params) ⇒ Fault
constructor
A new instance of Fault.
- #type ⇒ Object
Constructor Details
#initialize(**params) ⇒ Fault
Returns a new instance of Fault.
10 11 12 13 14 15 16 17 |
# File 'lib/lite/command/fault.rb', line 10 def initialize(**params) @reason = params.fetch(:reason) @metadata = params.fetch(:metadata) @caused_by = params.fetch(:caused_by) @thrown_by = params.fetch(:thrown_by) super(reason) end |
Instance Attribute Details
#caused_by ⇒ Object (readonly)
Returns the value of attribute caused_by.
8 9 10 |
# File 'lib/lite/command/fault.rb', line 8 def caused_by @caused_by end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/lite/command/fault.rb', line 8 def @metadata end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
8 9 10 |
# File 'lib/lite/command/fault.rb', line 8 def reason @reason end |
#thrown_by ⇒ Object (readonly)
Returns the value of attribute thrown_by.
8 9 10 |
# File 'lib/lite/command/fault.rb', line 8 def thrown_by @thrown_by end |
Class Method Details
.build(type, catcher, thrower, dynamic: false) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lite/command/fault.rb', line 19 def self.build(type, catcher, thrower, dynamic: false) klass = dynamic ? catcher.class : Lite::Command fault = klass.const_get(type.to_s) fault = fault.new( reason: catcher.reason, metadata: catcher., caused_by: catcher.caused_by, thrown_by: catcher.thrown_by ) fault.set_backtrace(thrower.backtrace) if thrower.respond_to?(:backtrace) fault end |
Instance Method Details
#type ⇒ Object
32 33 34 |
# File 'lib/lite/command/fault.rb', line 32 def type @type ||= self.class.name.split("::").last.downcase end |