Revision 3fdb26b1
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/DB/Object/Hooks.pm | ||
---|---|---|
|
||
foreach my $sub (@{ ( $hooks{$when} || { })->{ ref($object) } || [ ] }) {
|
||
my $result = ref($sub) eq 'CODE' ? $sub->($object, @args) : $object->call_sub($sub, @args);
|
||
SL::X::DBHookError->throw(error => "${when} hook '" . (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub) . "' failed") if !$result;
|
||
die SL::X::DBHookError->new(
|
||
hook => (ref($sub) eq 'CODE' ? '<anonymous sub>' : $sub),
|
||
when => $when,
|
||
object => $object,
|
||
) if !$result;
|
||
}
|
||
}
|
||
|
SL/X.pm | ||
---|---|---|
use Exception::Lite qw(declareExceptionClass);
|
||
|
||
declareExceptionClass('SL::X::FormError');
|
||
declareExceptionClass('SL::X::DBHookError');
|
||
declareExceptionClass('SL::X::DBHookError', [ '%s hook \'%s\' failed', qw(when hook object) ]);
|
||
|
||
1;
|
Auch abrufbar als: Unified diff
DBHookError Objekte haben jetzt Felder für etwas einfachere Verwendung.
Conflicts: