From: Moritz Bunkus Date: Thu, 4 Apr 2013 07:53:04 +0000 (+0200) Subject: DB-Object-Hooks: bei Exception in Hook auch Objekttyp in Exception-Text aufnehmen X-Git-Tag: release-3.1.0beta1~486^2 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0281b86dc6c14910b263e7771673599544973616;p=kivitendo-erp.git DB-Object-Hooks: bei Exception in Hook auch Objekttyp in Exception-Text aufnehmen --- diff --git a/SL/DB/Object/Hooks.pm b/SL/DB/Object/Hooks.pm index 3839286ba..371e4450e 100644 --- a/SL/DB/Object/Hooks.pm +++ b/SL/DB/Object/Hooks.pm @@ -44,9 +44,10 @@ sub run_hooks { foreach my $sub (@{ ( $hooks{$when} || { })->{ ref($object) } || [ ] }) { my $result = ref($sub) eq 'CODE' ? $sub->($object, @args) : $object->call_sub($sub, @args); - die SL::X::DBHookError->new(when => $when, - hook => (ref($sub) eq 'CODE' ? '' : $sub), - object => $object) + die SL::X::DBHookError->new(when => $when, + hook => (ref($sub) eq 'CODE' ? '' : $sub), + object => $object, + object_type => ref($object)) if !$result; } } diff --git a/SL/X.pm b/SL/X.pm index 0f206949b..552e5ef29 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', [ '%s hook \'%s\' failed', qw(when hook object) ]); +declareExceptionClass('SL::X::DBHookError', [ '%s hook \'%s\' for object type \'%s\' failed', qw(when hook object_type object) ]); 1;