projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
POD-Dokumentation
[kivitendo-erp.git]
/
SL
/
DB
/
Object.pm
diff --git
a/SL/DB/Object.pm
b/SL/DB/Object.pm
index
a80640c
..
d176a1f
100755
(executable)
--- a/
SL/DB/Object.pm
+++ b/
SL/DB/Object.pm
@@
-2,6
+2,7
@@
package SL::DB::Object;
use strict;
use strict;
+use English qw(-no_match_vars);
use Rose::DB::Object;
use List::MoreUtils qw(any);
use Rose::DB::Object;
use List::MoreUtils qw(any);
@@
-111,28
+112,44
@@
sub load {
sub save {
my ($self, @args) = @_;
sub save {
my ($self, @args) = @_;
- my
$result
;
+ my
($result, $exception)
;
my $worker = sub {
SL::DB::Object::Hooks::run_hooks($self, 'before_save');
my $worker = sub {
SL::DB::Object::Hooks::run_hooks($self, 'before_save');
- $result = $self->SUPER::save(@args);
+ $exception = $EVAL_ERROR unless eval {
+ $result = $self->SUPER::save(@args);
+ 1;
+ };
SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result);
SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result);
+
+ return $result;
};
$self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
};
$self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
+
+ die $exception if $exception;
+
return $result;
}
sub delete {
my ($self, @args) = @_;
return $result;
}
sub delete {
my ($self, @args) = @_;
- my
$result
;
+ my
($result, $exception)
;
my $worker = sub {
SL::DB::Object::Hooks::run_hooks($self, 'before_delete');
my $worker = sub {
SL::DB::Object::Hooks::run_hooks($self, 'before_delete');
- $result = $self->SUPER::delete(@args);
+ $exception = $EVAL_ERROR unless eval {
+ $result = $self->SUPER::delete(@args);
+ 1;
+ };
SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result);
SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result);
+
+ return $result;
};
$self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
};
$self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker);
+
+ die $exception if $exception;
+
return $result;
}
return $result;
}