From 3d7decb14536a244e265ca29d4f13dd6ce98ef88 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 29 Jun 2018 11:02:57 -0300 Subject: [PATCH] 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 --- Koha/Exceptions/Exception.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Koha/Exceptions/Exception.pm b/Koha/Exceptions/Exception.pm index 6768587613..3b311b8322 100644 --- a/Koha/Exceptions/Exception.pm +++ b/Koha/Exceptions/Exception.pm @@ -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; -- 2.18.0