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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomas Cohen Arazi 2018-06-29 11:02:57 -03:00 committed by Martin Renvoize
parent 7130267d64
commit 220a9adea9
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 4 additions and 2 deletions

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;