Revision 27ffa16a
Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt
SL/BackgroundJob/CreatePeriodicInvoices.pm | ||
---|---|---|
240 | 240 |
eval { |
241 | 241 |
$form->parse_template(\%::myconfig); |
242 | 242 |
1; |
243 |
} || die $EVAL_ERROR->{error};
|
|
243 |
} || die $EVAL_ERROR->getMessage;
|
|
244 | 244 |
}); |
245 | 245 |
} |
246 | 246 |
|
SL/Form.pm | ||
---|---|---|
62 | 62 |
use SL::OE; |
63 | 63 |
use SL::Template; |
64 | 64 |
use SL::User; |
65 |
use SL::X; |
|
65 | 66 |
use Template; |
66 | 67 |
use URI; |
67 | 68 |
use List::Util qw(first max min sum); |
... | ... | |
458 | 459 |
|
459 | 460 |
sub throw_on_error { |
460 | 461 |
my ($self, $code) = @_; |
461 |
local $self->{__ERROR_HANDLER} = sub { die({ error => $_[0] }) };
|
|
462 |
local $self->{__ERROR_HANDLER} = sub { die SL::X::FormError->new($_[0]) };
|
|
462 | 463 |
$code->(); |
463 | 464 |
} |
464 | 465 |
|
SL/X.pm | ||
---|---|---|
1 |
package SL::X; |
|
2 |
|
|
3 |
use strict; |
|
4 |
|
|
5 |
use Exception::Lite qw(declareExceptionClass); |
|
6 |
|
|
7 |
declareExceptionClass('SL::X::FormError'); |
|
8 |
|
|
9 |
1; |
Auch abrufbar als: Unified diff
Umstellung Form::throw_on_error auf Verwendung von Exception::Lite anstelle von Hashrefs