Bug 21022: Use passed message if present

This patch makes 'full_message' use the passed exception message instead
of trying to build it from the parameters. This is particularly useful
for some situations in which we don't have all the information but would
like to keep using the same exception.

To test:
- Apply this patchset
- Run:
  $ kshell
 k$ prove t/Koha/Exceptions.t
=> SUCCESS: Tests pass!
- Sign off

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Tomás Cohen Arazi 2018-06-29 11:02:57 -03:00 committed by Nick Clemens
parent 3dd378fa18
commit 07c6699a7b

View file

@ -15,8 +15,10 @@ sub full_message {
my $msg = $self->message;
if ( $self->isa('Koha::Exceptions::Object::FKConstraint') ) {
$msg = sprintf("Invalid parameter passed, %s=%s does not exist", $self->broken_fk, $self->value );
unless ( $msg) {
if ( $self->isa('Koha::Exceptions::Object::FKConstraint') ) {
$msg = sprintf("Invalid parameter passed, %s=%s does not exist", $self->broken_fk, $self->value );
}
}
return $msg;