From: Moritz Bunkus Date: Fri, 19 Apr 2013 12:14:02 +0000 (+0200) Subject: RDBO: Exceptions in before_*/after_*-Hooks bubblen X-Git-Tag: release-3.1.0beta1~486^2~4 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0bae09796539d19ca18f6567dac468271404e7c3;p=kivitendo-erp.git RDBO: Exceptions in before_*/after_*-Hooks bubblen --- diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index 1c7c050ea..8b86e9711 100755 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -134,12 +134,12 @@ sub save { my ($result, $exception); my $worker = sub { - SL::DB::Object::Hooks::run_hooks($self, 'before_save'); $exception = $EVAL_ERROR unless eval { + SL::DB::Object::Hooks::run_hooks($self, 'before_save'); $result = $self->SUPER::save(@args); + SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result); 1; }; - SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result); return $result; }; @@ -156,12 +156,12 @@ sub delete { my ($result, $exception); my $worker = sub { - SL::DB::Object::Hooks::run_hooks($self, 'before_delete'); $exception = $EVAL_ERROR unless eval { + SL::DB::Object::Hooks::run_hooks($self, 'before_delete'); $result = $self->SUPER::delete(@args); + SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result); 1; }; - SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result); return $result; };