From 33c14eb1b6e5b26eb99da85af3a5a0b4f988f7e6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Jan 2022 10:31:24 +0100 Subject: [PATCH] Bug 29857: Make the exception classes inherit from the base class We have a base class Koha::Exceptions::Exception but it's not used in most of our exception classes Signed-off-by: Tomas Cohen Arazi --- Koha/Exceptions/Account.pm | 4 +++- Koha/Exceptions/Acquisition/Basket.pm | 4 +++- Koha/Exceptions/ArticleRequest.pm | 6 ++++-- Koha/Exceptions/Authentication.pm | 4 +++- Koha/Exceptions/Authorization.pm | 4 +++- Koha/Exceptions/Checkout.pm | 4 +++- Koha/Exceptions/Checkouts/ReturnClaims.pm | 1 - Koha/Exceptions/ClubHold.pm | 4 +++- Koha/Exceptions/Config.pm | 4 +++- Koha/Exceptions/Elasticsearch.pm | 4 +++- Koha/Exceptions/Ill.pm | 4 +++- Koha/Exceptions/Item/Transfer.pm | 4 +++- Koha/Exceptions/Library.pm | 4 +++- Koha/Exceptions/MarcOverlayRule.pm | 4 +++- Koha/Exceptions/Metadata.pm | 4 +++- Koha/Exceptions/Password.pm | 4 +++- Koha/Exceptions/Patron.pm | 4 +++- Koha/Exceptions/Patron/Attribute.pm | 4 +++- Koha/Exceptions/Patron/Attribute/Type.pm | 4 +++- Koha/Exceptions/Patron/Modification.pm | 4 +++- Koha/Exceptions/Patron/Relationship.pm | 4 +++- Koha/Exceptions/Token.pm | 4 +++- Koha/Exceptions/TransferLimit.pm | 4 +++- 23 files changed, 67 insertions(+), 24 deletions(-) diff --git a/Koha/Exceptions/Account.pm b/Koha/Exceptions/Account.pm index c598dd92da..a34c00ee3c 100644 --- a/Koha/Exceptions/Account.pm +++ b/Koha/Exceptions/Account.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Account; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Account' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Account::IsNotCredit' => { isa => 'Koha::Exceptions::Account', diff --git a/Koha/Exceptions/Acquisition/Basket.pm b/Koha/Exceptions/Acquisition/Basket.pm index 94ca5cbf51..52fb45ab30 100644 --- a/Koha/Exceptions/Acquisition/Basket.pm +++ b/Koha/Exceptions/Acquisition/Basket.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Acquisition::Basket; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Acquisition::Basket' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Acquisition::Basket::AlreadyClosed' => { isa => 'Koha::Exceptions::Acquisition::Basket', diff --git a/Koha/Exceptions/ArticleRequest.pm b/Koha/Exceptions/ArticleRequest.pm index ef0f25769e..99e4059929 100644 --- a/Koha/Exceptions/ArticleRequest.pm +++ b/Koha/Exceptions/ArticleRequest.pm @@ -17,9 +17,11 @@ package Koha::Exceptions::ArticleRequest; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::ArticleRequest' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::ArticleRequest::LimitReached' => { isa => 'Koha::Exceptions::ArticleRequest', @@ -43,4 +45,4 @@ Exception to be used when the article request limit has been reached. =cut -1; \ No newline at end of file +1; diff --git a/Koha/Exceptions/Authentication.pm b/Koha/Exceptions/Authentication.pm index 74688ab6fb..e8c3227523 100644 --- a/Koha/Exceptions/Authentication.pm +++ b/Koha/Exceptions/Authentication.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Authentication; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Authentication' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Authentication::Required' => { isa => 'Koha::Exceptions::Authentication', diff --git a/Koha/Exceptions/Authorization.pm b/Koha/Exceptions/Authorization.pm index a3c625aca8..1b070df1d0 100644 --- a/Koha/Exceptions/Authorization.pm +++ b/Koha/Exceptions/Authorization.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Authorization; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Authorization' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Authorization::Unauthorized' => { isa => 'Koha::Exceptions::Authorization', diff --git a/Koha/Exceptions/Checkout.pm b/Koha/Exceptions/Checkout.pm index ed4b0a5a27..f6ceb038fc 100644 --- a/Koha/Exceptions/Checkout.pm +++ b/Koha/Exceptions/Checkout.pm @@ -2,9 +2,11 @@ package Koha::Exceptions::Checkout; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Checkout' => { - description => "Something went wrong!" + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Checkout::FailedRenewal' => { isa => 'Koha::Exceptions::Checkout', diff --git a/Koha/Exceptions/Checkouts/ReturnClaims.pm b/Koha/Exceptions/Checkouts/ReturnClaims.pm index 8629bbb677..d1a63f8037 100644 --- a/Koha/Exceptions/Checkouts/ReturnClaims.pm +++ b/Koha/Exceptions/Checkouts/ReturnClaims.pm @@ -22,7 +22,6 @@ use Koha::Exceptions::Exception; use Exception::Class ( 'Koha::Exceptions::Checkouts::ReturnClaims' => { isa => 'Koha::Exceptions::Exception', - description => 'Something went wrong!', }, 'Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy' => { isa => 'Koha::Exceptions::Checkouts::ReturnClaims', diff --git a/Koha/Exceptions/ClubHold.pm b/Koha/Exceptions/ClubHold.pm index e787c27908..d7ca3bf914 100644 --- a/Koha/Exceptions/ClubHold.pm +++ b/Koha/Exceptions/ClubHold.pm @@ -2,9 +2,11 @@ package Koha::Exceptions::ClubHold; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::ClubHold' => { - description => "Something went wrong!", + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::ClubHold::NoPatrons' => { isa => 'Koha::Exceptions::ClubHold', diff --git a/Koha/Exceptions/Config.pm b/Koha/Exceptions/Config.pm index 14ae315246..2a9488eb62 100644 --- a/Koha/Exceptions/Config.pm +++ b/Koha/Exceptions/Config.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Config; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Config' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Config::MissingEntry' => { isa => 'Koha::Exceptions::Config', diff --git a/Koha/Exceptions/Elasticsearch.pm b/Koha/Exceptions/Elasticsearch.pm index 2068db9fda..37d993fcc6 100644 --- a/Koha/Exceptions/Elasticsearch.pm +++ b/Koha/Exceptions/Elasticsearch.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Elasticsearch; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Elasticsearch' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Elasticsearch::BadResponse' => { isa => 'Koha::Exceptions::Elasticsearch', diff --git a/Koha/Exceptions/Ill.pm b/Koha/Exceptions/Ill.pm index 0729fa47d2..66d5adcdd9 100644 --- a/Koha/Exceptions/Ill.pm +++ b/Koha/Exceptions/Ill.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Ill; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Ill' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Ill::InvalidBackendId' => { isa => 'Koha::Exceptions::Ill', diff --git a/Koha/Exceptions/Item/Transfer.pm b/Koha/Exceptions/Item/Transfer.pm index a836714dbc..0d8aea59c7 100644 --- a/Koha/Exceptions/Item/Transfer.pm +++ b/Koha/Exceptions/Item/Transfer.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Item::Transfer; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Item::Transfer' => { - description => 'Something went wrong' + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Item::Transfer::InQueue' => { isa => 'Koha::Exceptions::Item::Transfer', diff --git a/Koha/Exceptions/Library.pm b/Koha/Exceptions/Library.pm index d4b0cfebc3..06ee38cf0d 100644 --- a/Koha/Exceptions/Library.pm +++ b/Koha/Exceptions/Library.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Library; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Library::Exception' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Library::NotFound' => { diff --git a/Koha/Exceptions/MarcOverlayRule.pm b/Koha/Exceptions/MarcOverlayRule.pm index f3596022e7..799469041f 100644 --- a/Koha/Exceptions/MarcOverlayRule.pm +++ b/Koha/Exceptions/MarcOverlayRule.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::MarcOverlayRule; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::MarcOverlayRule' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp' => { isa => 'Koha::Exceptions::MarcOverlayRule', diff --git a/Koha/Exceptions/Metadata.pm b/Koha/Exceptions/Metadata.pm index 8c95fa0556..683bf9d50d 100644 --- a/Koha/Exceptions/Metadata.pm +++ b/Koha/Exceptions/Metadata.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Metadata; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Metadata' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Metadata::Invalid' => { isa => 'Koha::Exceptions::Metadata', diff --git a/Koha/Exceptions/Password.pm b/Koha/Exceptions/Password.pm index 549e3b9519..7219a0092a 100644 --- a/Koha/Exceptions/Password.pm +++ b/Koha/Exceptions/Password.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Password; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Password' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Password::Invalid' => { isa => 'Koha::Exceptions::Password', diff --git a/Koha/Exceptions/Patron.pm b/Koha/Exceptions/Patron.pm index 1bd51eb55e..3c7ee9651f 100644 --- a/Koha/Exceptions/Patron.pm +++ b/Koha/Exceptions/Patron.pm @@ -2,9 +2,11 @@ package Koha::Exceptions::Patron; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Patron' => { - description => "Something went wrong!" + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Patron::FailedDelete' => { isa => 'Koha::Exceptions::Patron', diff --git a/Koha/Exceptions/Patron/Attribute.pm b/Koha/Exceptions/Patron/Attribute.pm index 97785d6e2a..32f730f75e 100644 --- a/Koha/Exceptions/Patron/Attribute.pm +++ b/Koha/Exceptions/Patron/Attribute.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Patron::Attribute; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Patron::Attribute' => { - description => 'Something went wrong' + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Patron::Attribute::InvalidType' => { isa => 'Koha::Exceptions::Patron::Attribute', diff --git a/Koha/Exceptions/Patron/Attribute/Type.pm b/Koha/Exceptions/Patron/Attribute/Type.pm index 741b2f7254..11a3b577d1 100644 --- a/Koha/Exceptions/Patron/Attribute/Type.pm +++ b/Koha/Exceptions/Patron/Attribute/Type.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Patron::Attribute::Type; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Patron::Attribute::Type' => { - description => 'Something went wrong' + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Patron::Attribute::Type::CannotChangeProperty' => { isa => 'Koha::Exceptions::Patron::Attribute::Type', diff --git a/Koha/Exceptions/Patron/Modification.pm b/Koha/Exceptions/Patron/Modification.pm index d9ba650e64..790c930d2d 100644 --- a/Koha/Exceptions/Patron/Modification.pm +++ b/Koha/Exceptions/Patron/Modification.pm @@ -2,10 +2,12 @@ package Koha::Exceptions::Patron::Modification; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Patron::Modification' => { - description => 'Something went wrong' + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Patron::Modification::DuplicateVerificationToken' => { isa => 'Koha::Exceptions::Patron::Modification', diff --git a/Koha/Exceptions/Patron/Relationship.pm b/Koha/Exceptions/Patron/Relationship.pm index ca719cbe42..318e13d546 100644 --- a/Koha/Exceptions/Patron/Relationship.pm +++ b/Koha/Exceptions/Patron/Relationship.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::Patron::Relationship; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Patron::Relationship' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Patron::Relationship::DuplicateRelationship' => { isa => 'Koha::Exceptions::Patron::Relationship', diff --git a/Koha/Exceptions/Token.pm b/Koha/Exceptions/Token.pm index ae9bbec3c9..5f024feb07 100644 --- a/Koha/Exceptions/Token.pm +++ b/Koha/Exceptions/Token.pm @@ -17,9 +17,11 @@ package Koha::Exceptions::Token; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::Token' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::Token::BadPattern' => { isa => 'Koha::Exceptions::Token', diff --git a/Koha/Exceptions/TransferLimit.pm b/Koha/Exceptions/TransferLimit.pm index 1549ed2340..0225b2dbf8 100644 --- a/Koha/Exceptions/TransferLimit.pm +++ b/Koha/Exceptions/TransferLimit.pm @@ -17,10 +17,12 @@ package Koha::Exceptions::TransferLimit; use Modern::Perl; +use Koha::Exceptions::Exception; + use Exception::Class ( 'Koha::Exceptions::TransferLimit::Exception' => { - description => 'Something went wrong!', + isa => 'Koha::Exceptions::Exception', }, 'Koha::Exceptions::TransferLimit::Duplicate' => { -- 2.32.0