Method: PryExceptionExplorer.wrap

Defined in:
lib/pry-exception_explorer.rb

.wrap { ... } ⇒ Object

Wrap the provided block - intercepting all exceptions that bubble out, provided they satisfy the assertion in PryExceptionExplorer.intercept.

Yields:

  • The block to wrap.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pry-exception_explorer.rb', line 85

def wrap
  old_enabled, old_inline = enabled, inline
  self.inline      = false
  self.enabled     = true
  yield
rescue Exception => ex
  if ex.should_intercept?
    enter_exception(ex)
  else
    raise ex
  end
ensure
  self.enabled = old_enabled
  self.inline  = old_inline
end