From 0281b86dc6c14910b263e7771673599544973616 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 4 Apr 2013 09:53:04 +0200 Subject: [PATCH] DB-Object-Hooks: bei Exception in Hook auch Objekttyp in Exception-Text aufnehmen --- SL/DB/Object/Hooks.pm | 7 ++++--- SL/X.pm | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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; -- 2.20.1