Exception: HatiCommand::Errors::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- HatiCommand::Errors::BaseError
- Defined in:
- lib/hati_command/errors/base_error.rb
Overview
Custom BaseError class for command issues scenarios in HatiCommand
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_MSG =
'Default message: Oooops! Something went wrong. Please check the logs.'
Instance Attribute Summary collapse
-
#failure_obj ⇒ Object
readonly
Returns the value of attribute failure_obj.
Instance Method Summary collapse
- #build_msg ⇒ Object
- #default_message ⇒ Object
- #error_klass ⇒ Object
-
#initialize(message = nil, failure_obj: nil) ⇒ BaseError
constructor
A new instance of BaseError.
Constructor Details
#initialize(message = nil, failure_obj: nil) ⇒ BaseError
Returns a new instance of BaseError.
16 17 18 19 20 |
# File 'lib/hati_command/errors/base_error.rb', line 16 def initialize( = nil, failure_obj: nil) msg = build_msg + ( || ) super(msg) @failure_obj = failure_obj end |
Instance Attribute Details
#failure_obj ⇒ Object (readonly)
Returns the value of attribute failure_obj.
12 13 14 |
# File 'lib/hati_command/errors/base_error.rb', line 12 def failure_obj @failure_obj end |
Instance Method Details
#build_msg ⇒ Object
26 27 28 |
# File 'lib/hati_command/errors/base_error.rb', line 26 def build_msg "[#{error_klass}] " end |
#default_message ⇒ Object
30 31 32 |
# File 'lib/hati_command/errors/base_error.rb', line 30 def DEFAULT_MSG end |
#error_klass ⇒ Object
22 23 24 |
# File 'lib/hati_command/errors/base_error.rb', line 22 def error_klass self.class.name end |