[boulder.pm] Error/Exception module recommendations?

Rob Nagler nagler at bivio.net
Sun Nov 11 15:52:03 CST 2001


> Anyone have a favorite exception handling module they'd like to
> recommend?

Bivio::Die as a part of bOP, e.g

    my($die) = Bivio::Die->catch(code or sub);
    if ($die) {
        process $die which has all sorts of state info including stack.
    }

> Bonus points for a design more oriented towards
> gracefully handling external (network/DB/filesystem) resource
> errors.

We use it for this type of stuff.  Here's a snippet from
Bivio::Biz::FormModel (which wraps HTTP forms into objects and deals
with all kinds of stuff like uniqueness constraint violations
automatically):

	# Catch errors and rethrow unless we can process
	my($res);
	my($die) = Bivio::Die->catch(sub {
	        $res = $self->execute_ok($form_button);});
	if ($die) {
	    if ($die->get('code')== Bivio::DieCode->DB_CONSTRAINT) {
		# Type errors are "normal"
		_apply_type_error($self, $die);
	    }
	    else {
		$die->throw_die();
		# DOES NOT RETURN
	    }
	}

Download at http://www.bivio.net/hm/download-bOP  or if you'd like to
browse the documentation: http://www.bivio.net/f/bOP/html/index.html

Rob	




More information about the Boulder-pm mailing list