From 07c6699a7bd4204d002f135bfeddf33fcc831b54 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 Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- 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.39.5