Exception: Legate::ToolError
- Defined in:
- lib/legate/errors.rb
Overview
Base class for errors raised during tool execution. Supports wrapping an original cause exception for debugging.
Direct Known Subclasses
ToolArgumentError, ToolHttpError, ToolNetworkError, ToolTimeoutError
Instance Method Summary collapse
-
#cause ⇒ Exception?
The explicit wrapped cause if one was passed, otherwise Ruby’s implicit cause (set automatically when the error is raised inside a rescue).
-
#initialize(message = nil, cause: nil) ⇒ ToolError
constructor
A new instance of ToolError.
Constructor Details
#initialize(message = nil, cause: nil) ⇒ ToolError
Returns a new instance of ToolError.
31 32 33 34 35 |
# File 'lib/legate/errors.rb', line 31 def initialize( = nil, cause: nil) super() @cause = cause set_backtrace(cause.backtrace) if cause&.backtrace end |
Instance Method Details
#cause ⇒ Exception?
The explicit wrapped cause if one was passed, otherwise Ruby’s implicit cause (set automatically when the error is raised inside a rescue). Falling back to ‘super` means a caller that does `raise ToolError, msg` inside a rescue still surfaces the real cause instead of nil.
42 43 44 |
# File 'lib/legate/errors.rb', line 42 def cause @cause || super end |