module Byebug
def post_mortem
...
offender
...
Byebug.post_mortem do
end
raise 'error'
def offender
e.g.
enable post-mortem mode by wrapping this block with Byebug.post_mortem,
If you know that a particular block of code raises an exception you can
== Local post-mortem mode
and enables post-mortem mode.
at_exit hook that intercepts any exception not handled by your script
By calling Byebug.post_mortem method without a block, you install an
== Global post-mortem mode
Activates the post-mortem mode. There are two ways of using it:
#
def post_mortem if block_given? old_post_mortem = self.post_mortem? begin self.post_mortem = true yield rescue Exception => exp handle_post_mortem(exp) raise ensure self.post_mortem = old_post_mortem end else return if self.post_mortem? self.post_mortem = true debug_at_exit do handle_post_mortem($!) if $! && post_mortem? end end end