-
Notifications
You must be signed in to change notification settings - Fork 28
Home
pry-exception_explorer
is a plugin for the Pry REPL designed to intercept exceptions in your code. Once inside the session you have an opportunity to uncover the cause of the error and even to correct it, before letting your program continue. It is based on similar error consoles found in the Lisp and Smalltalk worlds.
As an alternative to using the full module name PryExceptionExplorer
, you can use the constant EE
instead. They both refer to the same object, but the abbreviated form may make programs more concise.
This method allows the user to define the situations where an exception interception occurs. This method can be invoked in two ways.
The general form takes a block, the block is passed both the frame where the exception was raised, and the exception itself. The user then creates an assertion (a stack-assertion) based on these attributes. If the assertion is later satisfied by a raised exception, that exception will be intercepted.
The first parameter yielded to the block is a PryExceptionExplorer::LazyFrame instance ( representing the context where the exception was raised), the second is the exception object.
The PryExceptionExplorer::LazyFrame
instance supports a number of methods that expose details of the stack frame: