I have another custom approach:
This way the module user can still use idioms like
$O->foo() or die "could not blabla: ".$O->error();
Users can still set the error handler to croak() if they wish. This could be extended ad nauseam: $debug switches, $exec_handler switch, method to get errMsg without resetting it -- you name it. I should probably put it in its own module, too, and inherit from that. I'm still not sure how to escalate errors when one method calls another. Maybe simply
sub bar {
my ($self) = @_;
foo() or return raiseError("bar failed to rhubarb: ".$self->error(
+));
return 1;
}
# ...
$O->bar() or die "could not blabla: ".$O->error();
# "could not blabla: bar failed to rhubarb: foo: could not do thisandt
+hat"
|