2 use strict; use warnings;
3 use Template qw(:template);
4 use OpenSRF::Utils::SettingsClient;
5 use OpenILS::Utils::Fieldmapper;
7 # ----------------------------------------------------------------------------------
8 # These exceptions are not thrown. They are returned as request result objects
9 # ----------------------------------------------------------------------------------
13 SEARCH_TOO_LARGE => 2,
17 use overload ( '""' => sub { $_[0]->ex()->err_msg(); } );
21 my($class, $type) = @_;
22 $class = ref($class) || $class;
27 $self->{ex} = new Fieldmapper::ex;
28 $self->{ex}->type($ex_types{$type});
29 $self->{ex}->err_msg($self->run());
30 warn "type is $type\n";
36 sub ex { return shift()->{ex}; }
43 my $conf = OpenSRF::Utils::SettingsClient->new;
45 my $script = $conf->config_value("ex_script");
47 my $template = Template->new(
56 my $status = $template->process($script,
57 { ex_types => \%ex_types, type => $self->{ex}->type });
60 return "Unable to process exception script. No meaningful data to return..." .
61 " Error is:\n" . $template->error() . "\n";
64 $result =~ s/^\s*//og;
65 warn " -|-|-|- Exception result [$result]\n";