Skip to content

Die and Exception Handling

moellep edited this page Nov 5, 2014 · 1 revision

Die: Programmatic Mapping of Perl's "die"

  • Bivio.Die provides a throw/catch model for exceptions:
my($die) = Bivio::Die->catch(sub {
    .... operation ....
});
if ($die) {
    ... handle error/rethrow ...
}
  • Every exception has a Bivio.DieCode (NOT_FOUND, CORRUPT_QUERY, etc.) plus an arbitrary collection of attributes.

  • handle_die is called LIFO order on objects in the stack before the stack is unwound, that is, before a catch gets to see the exception.

  • Die objects are chained if an exception is thrown within a handle_die

  • Filtering handled in perl, not in Bivio.Die->catch

  • Bivio.Die->eval is a catch, which tosses the Bivio.Die

  • Stack tracing is controlled by caller (throw_quietly, catch_quietly, or "program_error" attribute)

Clone this wiki locally