@@ -, +, @@ exceptions use Koha::Exceptions::Elasticsearch; Koha::Exceptions::Elasticsearch::BadResponse->throw( type => "a good type", details => "and some details" ); --- Koha/Exceptions/Exception.pm | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/Koha/Exceptions/Exception.pm +++ a/Koha/Exceptions/Exception.pm @@ -9,4 +9,17 @@ use Exception::Class ( }, ); +sub full_message { + my $self = shift; + my $msg = $self->description; + my @fields; + my $field_hash = $self->field_hash; + while ( my ( $field, $value ) = each %$field_hash ) { + push @fields, $field . " => " . $value; + } + return + sprintf "Exception '%s' thrown '%s'" . ( @fields ? " with %s" : "" ) . "\n", + ref($self), $msg, ( @fields ? join ', ', @fields : () ); +} + 1; --