Bug 20590: Include Koha::Exceptions::Exception
[koha.git] / Koha / Exceptions / Exception.pm
1 package Koha::Exceptions::Exception;
2
3 use Modern::Perl;
4
5 # Looks like this class should be more Koha::Exception::Base;
6 use Exception::Class (
7     'Koha::Exceptions::Exception' => {
8         description => "Something went wrong!"
9     },
10 );
11
12 # We want to overload it to have a stringification method for our exceptions
13 sub full_message {
14     my $self = shift;
15
16     my $msg = $self->message;
17
18     if ( $self->isa('Koha::Exceptions::Object::FKConstraint') ) {
19         $msg = sprintf("Invalid parameter passed, %s=%s does not exist", $self->broken_fk, $self->value );
20     }
21
22     return $msg;
23 }
24
25 1;