From: Moritz Bunkus Date: Tue, 3 May 2011 15:27:07 +0000 (+0200) Subject: Umstellung Form::throw_on_error auf Verwendung von Exception::Lite anstelle von Hashrefs X-Git-Tag: release-2.6.3~28^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=27ffa16a85221662dee49da0f210312383341240;p=kivitendo-erp.git Umstellung Form::throw_on_error auf Verwendung von Exception::Lite anstelle von Hashrefs --- diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index c725a6fec..559fd0299 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -240,7 +240,7 @@ sub _print_invoice { eval { $form->parse_template(\%::myconfig); 1; - } || die $EVAL_ERROR->{error}; + } || die $EVAL_ERROR->getMessage; }); } diff --git a/SL/Form.pm b/SL/Form.pm index b63421750..b3a3e23df 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -62,6 +62,7 @@ use SL::Menu; use SL::OE; use SL::Template; use SL::User; +use SL::X; use Template; use URI; use List::Util qw(first max min sum); @@ -458,7 +459,7 @@ sub hide_form { sub throw_on_error { my ($self, $code) = @_; - local $self->{__ERROR_HANDLER} = sub { die({ error => $_[0] }) }; + local $self->{__ERROR_HANDLER} = sub { die SL::X::FormError->new($_[0]) }; $code->(); } diff --git a/SL/X.pm b/SL/X.pm new file mode 100644 index 000000000..ce7552c1e --- /dev/null +++ b/SL/X.pm @@ -0,0 +1,9 @@ +package SL::X; + +use strict; + +use Exception::Lite qw(declareExceptionClass); + +declareExceptionClass('SL::X::FormError'); + +1;