Class: Telebugs::WrappedError
- Inherits:
-
Object
- Object
- Telebugs::WrappedError
- Defined in:
- lib/telebugs/wrapped_error.rb
Overview
WrappedError unwraps an error and its causes up to a certain depth.
Constant Summary collapse
- MAX_NESTED_ERRORS =
3
Instance Method Summary collapse
-
#initialize(error) ⇒ WrappedError
constructor
A new instance of WrappedError.
- #unwrap ⇒ Object
Constructor Details
#initialize(error) ⇒ WrappedError
Returns a new instance of WrappedError.
8 9 10 |
# File 'lib/telebugs/wrapped_error.rb', line 8 def initialize(error) @error = error end |
Instance Method Details
#unwrap ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/telebugs/wrapped_error.rb', line 12 def unwrap error_list = [] error = @error while error && error_list.size < MAX_NESTED_ERRORS error_list << error error = error.cause end error_list end |