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,
16 use overload ( '""' => sub { $_[0]->ex()->err_msg(); } );
20 my($class, $type) = @_;
21 $class = ref($class) || $class;
26 $self->{ex} = new Fieldmapper::ex;
27 $self->{ex}->type($ex_types{$type});
28 $self->{ex}->err_msg($self->run());
29 warn "type is $type\n";
35 sub ex { return shift()->{ex}; }
42 my $conf = OpenSRF::Utils::SettingsClient->new;
44 my $script = $conf->config_value("ex_script");
46 my $template = Template->new(
55 my $status = $template->process($script,
56 { ex_types => \%ex_types, type => $self->{ex}->type });
59 return "Unable to process exception script. No meaningful data to return..." .
60 " Error is:\n" . $template->error() . "\n";
63 $result =~ s/^\s*//og;
64 warn " -|-|-|- Exception result [$result]\n";