From: Moritz Bunkus Date: Thu, 12 May 2011 08:43:47 +0000 (+0200) Subject: DBHookError Objekte haben jetzt Felder für etwas einfachere Verwendung. X-Git-Tag: release-2.6.3~25^2~49 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3fdb26b1be0178d1a450405f6d1d3976c19b9587;p=kivitendo-erp.git DBHookError Objekte haben jetzt Felder für etwas einfachere Verwendung. Conflicts: SL/X.pm --- diff --git a/SL/DB/Object/Hooks.pm b/SL/DB/Object/Hooks.pm index 00567559a..e47951407 100644 --- a/SL/DB/Object/Hooks.pm +++ b/SL/DB/Object/Hooks.pm @@ -44,7 +44,11 @@ sub run_hooks { 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' ? '' : $sub) . "' failed") if !$result; + die SL::X::DBHookError->new( + hook => (ref($sub) eq 'CODE' ? '' : $sub), + when => $when, + object => $object, + ) if !$result; } } diff --git a/SL/X.pm b/SL/X.pm index 8c130c3c9..0f206949b 100644 --- a/SL/X.pm +++ b/SL/X.pm @@ -5,6 +5,6 @@ use strict; 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;