Bugzilla – Attachment 191928 Details for
Bug 41694
Some Koha::Exception::Object instances fail to produce a full_message
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41694: Ensure Koha::Exception::Object's full_message() always produces one
e1c8f79.patch (text/plain), 2.11 KB, created by
HKS3 Tadeusz Sośnierz
on 2026-01-23 13:35:48 UTC
(
hide
)
Description:
Bug 41694: Ensure Koha::Exception::Object's full_message() always produces one
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2026-01-23 13:35:48 UTC
Size:
2.11 KB
patch
obsolete
>From e1c8f79b8f69a3c60dd2c47eed44a7a5c5186b47 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Tadeusz=20=E2=80=9Etadzik=E2=80=9D=20So=C5=9Bnierz?= > <tadeusz@sosnierz.com> >Date: Fri, 23 Jan 2026 14:34:40 +0100 >Subject: [PATCH] Bug 41694: Ensure Koha::Exception::Object's full_message() > always produces one > >--- > Koha/Exceptions/Object.pm | 4 ++++ > t/Koha/Exceptions.t | 29 ++++++++++++++++++++++++++++- > 2 files changed, 32 insertions(+), 1 deletion(-) > >diff --git a/Koha/Exceptions/Object.pm b/Koha/Exceptions/Object.pm >index 85181d9f90..57aa4c8bc3 100644 >--- a/Koha/Exceptions/Object.pm >+++ b/Koha/Exceptions/Object.pm >@@ -92,6 +92,10 @@ sub full_message { > } > } > >+ if ( !$msg ) { >+ return $self->SUPER::full_message; >+ } >+ > return $msg; > } > >diff --git a/t/Koha/Exceptions.t b/t/Koha/Exceptions.t >index 0f12bc2e7d..3cd6f02c56 100755 >--- a/t/Koha/Exceptions.t >+++ b/t/Koha/Exceptions.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 13; >+use Test::More tests => 14; > use Test::MockObject; > use Test::Exception; > >@@ -427,3 +427,30 @@ subtest 'Passing parameters when throwing exception' => sub { > like( $desc, qr/type => ARRAY/, 'Found type' ); > like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' ); > }; >+ >+subtest 'full_message() should provide all the details' => sub { >+ plan tests => 6; >+ >+ use Koha::Exceptions::Object; >+ >+ throws_ok { >+ Koha::Exceptions::Object::DuplicateID->throw( >+ duplicate_id => 'test_id', >+ message => 'the message', >+ ); >+ } >+ 'Koha::Exceptions::Object::DuplicateID'; >+ >+ like( $@->full_message, qr/the message/, 'Found the message' ); >+ unlike( $@->full_message, qr/test_id/, 'The message hides the original details' ); >+ >+ throws_ok { >+ Koha::Exceptions::Object::DuplicateID->throw( >+ duplicate_id => 'test_id', >+ ); >+ } >+ 'Koha::Exceptions::Object::DuplicateID'; >+ >+ like( $@->full_message, qr/DuplicateID/, 'Found exception type' ); >+ like( $@->full_message, qr/test_id/, 'The message hides the original details' ); >+}; >-- >2.51.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41694
: 191928