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