Exception: SimpleFormsApi::FormRemediation::Error
- Inherits:
-
StandardError
- Object
- StandardError
- SimpleFormsApi::FormRemediation::Error
- Defined in:
- lib/simple_forms_api/form_remediation/error.rb
Constant Summary collapse
- DEFAULT_MESSAGE =
'An error occurred during the form remediation process'
Instance Attribute Summary collapse
-
#base_error ⇒ Object
readonly
Returns the value of attribute base_error.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
Instance Method Summary collapse
- #backtrace ⇒ Object
- #custom_message ⇒ Object private
-
#initialize(message: DEFAULT_MESSAGE, error: nil, details: nil, backtrace: nil) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
Constructor Details
#initialize(message: DEFAULT_MESSAGE, error: nil, details: nil, backtrace: nil) ⇒ Error
Returns a new instance of Error.
10 11 12 13 14 15 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 10 def initialize(message: DEFAULT_MESSAGE, error: nil, details: nil, backtrace: nil) super() @base_error = error @details = details @custom_backtrace = backtrace end |
Instance Attribute Details
#base_error ⇒ Object (readonly)
Returns the value of attribute base_error.
6 7 8 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 6 def base_error @base_error end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
6 7 8 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 6 def details @details end |
Instance Method Details
#backtrace ⇒ Object
21 22 23 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 21 def backtrace @custom_backtrace || base_error&.backtrace || super end |
#custom_message ⇒ Object (private)
27 28 29 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 27 def details.is_a?(Hash) ? details[:message] : base_error&. end |
#message ⇒ Object
17 18 19 |
# File 'lib/simple_forms_api/form_remediation/error.rb', line 17 def [super, ].compact.join(' - ') end |