]> wagnertech.de Git - mfinanz.git/commitdiff
DBHookError Objekte haben jetzt Felder für etwas einfachere Verwendung.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 12 May 2011 08:43:47 +0000 (10:43 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 12 May 2011 09:24:34 +0000 (11:24 +0200)
Conflicts:

SL/X.pm

SL/DB/Object/Hooks.pm
SL/X.pm

index 00567559a32b7bcecda48d8d67028e59e6f27ec2..e47951407643ab3be12d52d9796ef500da150279 100644 (file)
@@ -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' ? '<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;
   }
 }
 
diff --git a/SL/X.pm b/SL/X.pm
index 8c130c3c9f1c6c26fea323eb207f7faae42748b3..0f206949bb34f03e5f68f08e727985533c105bcd 100644 (file)
--- 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;