|
Lines 10-24
use Exception::Class (
Link Here
|
| 10 |
|
10 |
|
| 11 |
sub full_message { |
11 |
sub full_message { |
| 12 |
my $self = shift; |
12 |
my $self = shift; |
| 13 |
my $msg = $self->description; |
13 |
|
| 14 |
my @fields; |
14 |
# If a message was passed manually, return it |
|
|
15 |
return $self->message |
| 16 |
if $self->message; |
| 17 |
|
| 15 |
my $field_hash = $self->field_hash; |
18 |
my $field_hash = $self->field_hash; |
| 16 |
while ( my ( $field, $value ) = each %$field_hash ) { |
19 |
|
| 17 |
push @fields, $field . " => " . $value; |
20 |
my $description = $self->description; |
|
|
21 |
my @fields; |
| 22 |
|
| 23 |
foreach my $key ( sort keys %$field_hash ) { |
| 24 |
push @fields, $key . " => " . $field_hash->{$key} |
| 25 |
if defined $field_hash->{$key}; |
| 18 |
} |
26 |
} |
|
|
27 |
|
| 19 |
return |
28 |
return |
| 20 |
sprintf "Exception '%s' thrown '%s'" . ( @fields ? " with %s" : "" ) . "\n", |
29 |
sprintf "Exception '%s' thrown '%s'" . ( @fields ? " with %s" : "" ) . "\n", |
| 21 |
ref($self), $msg, ( @fields ? join ', ', @fields : () ); |
30 |
ref($self), $description, ( @fields ? join ', ', @fields : () ); |
| 22 |
} |
31 |
} |
| 23 |
|
32 |
|
|
|
33 |
=head1 NAME |
| 34 |
|
| 35 |
Koha::Exception - Base class for exceptions |
| 36 |
|
| 37 |
=head1 Exceptions |
| 38 |
|
| 39 |
=head2 Koha::Exception |
| 40 |
|
| 41 |
Generic exception. |
| 42 |
|
| 43 |
=head1 Class methods |
| 44 |
|
| 45 |
=head2 full_message |
| 46 |
|
| 47 |
Generic method for exception stringifying. |
| 48 |
|
| 49 |
=cut |
| 50 |
|
| 24 |
1; |
51 |
1; |
| 25 |
- |
|
|