@@ -, +, @@ --- Koha/Acquisition/Orders.pm | 2 +- Koha/BackgroundJob.pm | 6 ++-- Koha/Checkout.pm | 4 +-- Koha/{Exceptions => }/Exception.pm | 5 ++- Koha/Exceptions.pm | 35 ++++++++++--------- Koha/Exceptions/Account.pm | 4 +-- Koha/Exceptions/Acquisition/Basket.pm | 4 +-- Koha/Exceptions/ArticleRequest.pm | 4 +-- Koha/Exceptions/Authentication.pm | 4 +-- Koha/Exceptions/Authorization.pm | 4 +-- Koha/Exceptions/Checkout.pm | 4 +-- Koha/Exceptions/Checkouts/ReturnClaims.pm | 4 +-- Koha/Exceptions/ClubHold.pm | 4 +-- Koha/Exceptions/Config.pm | 4 +-- Koha/Exceptions/Elasticsearch.pm | 4 +-- Koha/Exceptions/Hold.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/Object.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/Plugin.pm | 4 +-- Koha/Exceptions/Token.pm | 4 +-- Koha/Exceptions/TransferLimit.pm | 4 +-- Koha/Object.pm | 2 +- Koha/REST/V1/Patrons.pm | 4 +-- Koha/Script.pm | 6 ++-- Koha/SearchEngine/Elasticsearch/Indexer.pm | 4 +-- admin/smart-rules.pl | 6 ++-- .../Koha/BackgroundJobs/BatchUpdateBiblio.t | 4 +-- t/db_dependent/Koha/Biblio.t | 4 +-- t/db_dependent/Koha/Object.t | 2 +- t/db_dependent/api/v1/unhandled_exceptions.t | 2 +- t/lib/plugins/Koha/Plugin/Test.pm | 24 ++++++------- .../Koha/Plugin/TestItemBarcodeTransform.pm | 4 +-- tools/batchMod.pl | 2 +- 43 files changed, 110 insertions(+), 110 deletions(-) rename Koha/{Exceptions => }/Exception.pm (78%) --- a/Koha/Acquisition/Orders.pm +++ a/Koha/Acquisition/Orders.pm @@ -22,7 +22,7 @@ use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Acquisition::Order; -use Koha::Exceptions::Exception; +use Koha::Exception; use base qw(Koha::Objects); --- a/Koha/BackgroundJob.pm +++ a/Koha/BackgroundJob.pm @@ -126,9 +126,9 @@ sub enqueue { # Picking a random id (memcached_namespace) from the config my $namespace = C4::Context->config('memcached_namespace'); $conn->send_with_receipt( { destination => sprintf("/queue/%s-%s", $namespace, $job_type), body => $json_args } ) - or Koha::Exceptions::Exception->throw('Job has not been enqueued'); + or Koha::Exception->throw('Job has not been enqueued'); } catch { - if ( ref($_) eq 'Koha::Exceptions::Exception' ) { + if ( ref($_) eq 'Koha::Exception' ) { $_->rethrow; } else { warn sprintf "The job has not been sent to the message broker: (%s)", $_; @@ -236,7 +236,7 @@ sub _derived_class { my $class = $self->type_to_class_mapping->{$job_type}; - Koha::Exceptions::Exception->throw($job_type . ' is not a valid job_type') + Koha::Exception->throw($job_type . ' is not a valid job_type') unless $class; eval "require $class"; --- a/Koha/Checkout.pm +++ a/Koha/Checkout.pm @@ -199,12 +199,12 @@ sub claim_returned { ); } catch { - if ( $_->isa('Koha::Exceptions::Exception') ) { + if ( $_->isa('Koha::Exception') ) { $_->rethrow(); } else { # ? - Koha::Exceptions::Exception->throw( "Unhandled exception" ); + Koha::Exception->throw( "Unhandled exception" ); } }; } --- a/Koha/Exceptions/Exception.pm +++ a/Koha/Exceptions/Exception.pm @@ -1,10 +1,9 @@ -package Koha::Exceptions::Exception; +package Koha::Exception; use Modern::Perl; -# Looks like this class should be more Koha::Exception::Base; use Exception::Class ( - 'Koha::Exceptions::Exception' => { + 'Koha::Exception' => { description => "Something went wrong!" }, ); --- a/Koha/Exceptions.pm +++ a/Koha/Exceptions.pm @@ -1,57 +1,58 @@ package Koha::Exceptions; use Modern::Perl; -use Koha::Exceptions::Exception; + +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::BadParameter' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'A bad parameter was given', fields => ['parameter'], }, 'Koha::Exceptions::DuplicateObject' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'Same object already exists', }, 'Koha::Exceptions::ObjectNotFound' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'The required object doesn\'t exist', }, 'Koha::Exceptions::ObjectNotCreated' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'The object have not been created', }, 'Koha::Exceptions::CannotDeleteDefault' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'The default value cannot be deleted' }, 'Koha::Exceptions::MissingParameter' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'A required parameter is missing' }, 'Koha::Exceptions::ParameterTooHigh' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'A passed parameter value is too high' }, 'Koha::Exceptions::NoChanges' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'No changes were made', }, 'Koha::Exceptions::WrongParameter' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'One or more parameters are wrong', }, 'Koha::Exceptions::NoPermission' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'You do not have permission for this action', }, 'Koha::Exceptions::CannotAddLibraryLimit' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'General problem adding a library limit' }, 'Koha::Exceptions::UnderMaintenance' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'Koha is under maintenance.' }, # Virtualshelves exceptions @@ -60,19 +61,19 @@ use Exception::Class ( description => "Duplicate shelf object", }, 'Koha::Exceptions::Virtualshelves::InvalidInviteKey' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => 'Invalid key on accepting the share', }, 'Koha::Exceptions::Virtualshelves::InvalidKeyOnSharing' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description=> 'Invalid key on sharing a shelf', }, 'Koha::Exceptions::Virtualshelves::ShareHasExpired' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description=> 'Cannot share this shelf, the share has expired', }, 'Koha::Exceptions::Virtualshelves::UseDbAdminAccount' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', description => "Invalid use of database administrator account", } ); --- a/Koha/Exceptions/Account.pm +++ a/Koha/Exceptions/Account.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Account; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Account' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Account::IsNotCredit' => { isa => 'Koha::Exceptions::Account', --- a/Koha/Exceptions/Acquisition/Basket.pm +++ a/Koha/Exceptions/Acquisition/Basket.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Acquisition::Basket; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Acquisition::Basket' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Acquisition::Basket::AlreadyClosed' => { isa => 'Koha::Exceptions::Acquisition::Basket', --- a/Koha/Exceptions/ArticleRequest.pm +++ a/Koha/Exceptions/ArticleRequest.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::ArticleRequest; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::ArticleRequest' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::ArticleRequest::LimitReached' => { isa => 'Koha::Exceptions::ArticleRequest', --- a/Koha/Exceptions/Authentication.pm +++ a/Koha/Exceptions/Authentication.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Authentication; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Authentication' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Authentication::Required' => { isa => 'Koha::Exceptions::Authentication', --- a/Koha/Exceptions/Authorization.pm +++ a/Koha/Exceptions/Authorization.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Authorization; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Authorization' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Authorization::Unauthorized' => { isa => 'Koha::Exceptions::Authorization', --- a/Koha/Exceptions/Checkout.pm +++ a/Koha/Exceptions/Checkout.pm @@ -2,11 +2,11 @@ package Koha::Exceptions::Checkout; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Checkout' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Checkout::FailedRenewal' => { isa => 'Koha::Exceptions::Checkout', --- a/Koha/Exceptions/Checkouts/ReturnClaims.pm +++ a/Koha/Exceptions/Checkouts/ReturnClaims.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::Checkouts::ReturnClaims; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Checkouts::ReturnClaims' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Checkouts::ReturnClaims::NoCreatedBy' => { isa => 'Koha::Exceptions::Checkouts::ReturnClaims', --- a/Koha/Exceptions/ClubHold.pm +++ a/Koha/Exceptions/ClubHold.pm @@ -2,11 +2,11 @@ package Koha::Exceptions::ClubHold; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::ClubHold' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::ClubHold::NoPatrons' => { isa => 'Koha::Exceptions::ClubHold', --- a/Koha/Exceptions/Config.pm +++ a/Koha/Exceptions/Config.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Config; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Config' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Config::MissingEntry' => { isa => 'Koha::Exceptions::Config', --- a/Koha/Exceptions/Elasticsearch.pm +++ a/Koha/Exceptions/Elasticsearch.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Elasticsearch; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Elasticsearch' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Elasticsearch::BadResponse' => { isa => 'Koha::Exceptions::Elasticsearch', --- a/Koha/Exceptions/Hold.pm +++ a/Koha/Exceptions/Hold.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::Hold; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Hold' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Hold::CannotSuspendFound' => { isa => 'Koha::Exceptions::Hold', --- a/Koha/Exceptions/Ill.pm +++ a/Koha/Exceptions/Ill.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Ill; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Ill' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Ill::InvalidBackendId' => { isa => 'Koha::Exceptions::Ill', --- a/Koha/Exceptions/Item/Transfer.pm +++ a/Koha/Exceptions/Item/Transfer.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Item::Transfer; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Item::Transfer' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Item::Transfer::InQueue' => { isa => 'Koha::Exceptions::Item::Transfer', --- a/Koha/Exceptions/Library.pm +++ a/Koha/Exceptions/Library.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Library; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Library::Exception' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Library::NotFound' => { --- a/Koha/Exceptions/MarcOverlayRule.pm +++ a/Koha/Exceptions/MarcOverlayRule.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::MarcOverlayRule; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::MarcOverlayRule' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp' => { isa => 'Koha::Exceptions::MarcOverlayRule', --- a/Koha/Exceptions/Metadata.pm +++ a/Koha/Exceptions/Metadata.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Metadata; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Metadata' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Metadata::Invalid' => { isa => 'Koha::Exceptions::Metadata', --- a/Koha/Exceptions/Object.pm +++ a/Koha/Exceptions/Object.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::Object; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Object' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Object::DuplicateID' => { isa => 'Koha::Exceptions::Object', --- a/Koha/Exceptions/Password.pm +++ a/Koha/Exceptions/Password.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Password; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Password' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Password::Invalid' => { isa => 'Koha::Exceptions::Password', --- a/Koha/Exceptions/Patron.pm +++ a/Koha/Exceptions/Patron.pm @@ -2,11 +2,11 @@ package Koha::Exceptions::Patron; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Patron' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Patron::FailedDelete' => { isa => 'Koha::Exceptions::Patron', --- a/Koha/Exceptions/Patron/Attribute.pm +++ a/Koha/Exceptions/Patron/Attribute.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Patron::Attribute; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Patron::Attribute' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Patron::Attribute::InvalidType' => { isa => 'Koha::Exceptions::Patron::Attribute', --- a/Koha/Exceptions/Patron/Attribute/Type.pm +++ a/Koha/Exceptions/Patron/Attribute/Type.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Patron::Attribute::Type; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Patron::Attribute::Type' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Patron::Attribute::Type::CannotChangeProperty' => { isa => 'Koha::Exceptions::Patron::Attribute::Type', --- a/Koha/Exceptions/Patron/Modification.pm +++ a/Koha/Exceptions/Patron/Modification.pm @@ -2,12 +2,12 @@ package Koha::Exceptions::Patron::Modification; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Patron::Modification' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Patron::Modification::DuplicateVerificationToken' => { isa => 'Koha::Exceptions::Patron::Modification', --- a/Koha/Exceptions/Patron/Relationship.pm +++ a/Koha/Exceptions/Patron/Relationship.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::Patron::Relationship; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Patron::Relationship' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Patron::Relationship::DuplicateRelationship' => { isa => 'Koha::Exceptions::Patron::Relationship', --- a/Koha/Exceptions/Plugin.pm +++ a/Koha/Exceptions/Plugin.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::Plugin; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Plugin' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Plugin::ForbiddenAction' => { isa => 'Koha::Exceptions::Plugin', --- a/Koha/Exceptions/Token.pm +++ a/Koha/Exceptions/Token.pm @@ -17,11 +17,11 @@ package Koha::Exceptions::Token; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::Token' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::Token::BadPattern' => { isa => 'Koha::Exceptions::Token', --- a/Koha/Exceptions/TransferLimit.pm +++ a/Koha/Exceptions/TransferLimit.pm @@ -17,12 +17,12 @@ package Koha::Exceptions::TransferLimit; use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Exception::Class ( 'Koha::Exceptions::TransferLimit::Exception' => { - isa => 'Koha::Exceptions::Exception', + isa => 'Koha::Exception', }, 'Koha::Exceptions::TransferLimit::Duplicate' => { --- a/Koha/Object.pm +++ a/Koha/Object.pm @@ -907,7 +907,7 @@ sub _handle_to_api_child { if ( defined $child ) { - Koha::Exceptions::Exception->throw( "Asked to embed $curr but its return value doesn't implement to_api" ) + Koha::Exception->throw( "Asked to embed $curr but its return value doesn't implement to_api" ) if defined $next and blessed $child and !$child->can('to_api'); if ( blessed $child ) { --- a/Koha/REST/V1/Patrons.pm +++ a/Koha/REST/V1/Patrons.pm @@ -338,7 +338,7 @@ sub delete { # Pick the first error, if any my ( $error ) = grep { $_->type eq 'error' } @{ $safe_to_delete->messages }; unless ( $error ) { - Koha::Exceptions::Exception->throw('Koha::Patron->safe_to_delete returned false but carried no error message'); + Koha::Exception->throw('Koha::Patron->safe_to_delete returned false but carried no error message'); } my $error_descriptions = { @@ -357,7 +357,7 @@ sub delete { } ); } else { - Koha::Exceptions::Exception->throw( 'Koha::Patron->safe_to_delete carried an unexpected message: ' . $error->message ); + Koha::Exception->throw( 'Koha::Patron->safe_to_delete carried an unexpected message: ' . $error->message ); } } --- a/Koha/Script.pm +++ a/Koha/Script.pm @@ -40,7 +40,7 @@ use Fcntl qw( LOCK_EX LOCK_NB ); use C4::Context; use Koha::Exceptions; -use Koha::Exceptions::Exception; +use Koha::Exception; sub import { my $class = shift; @@ -136,10 +136,10 @@ sub lock_exec { my $lock_params = ($params->{wait}) ? LOCK_EX : LOCK_EX | LOCK_NB; open my $lock_handle, '>', $self->{lock_file} - or Koha::Exceptions::Exception->throw("Unable to open the lock file ".$self->{lock_file}.": $!"); + or Koha::Exception->throw("Unable to open the lock file ".$self->{lock_file}.": $!"); $self->{lock_handle} = $lock_handle; flock( $lock_handle, $lock_params ) - or Koha::Exceptions::Exception->throw("Unable to acquire the lock ".$self->{lock_file}.": $!"); + or Koha::Exception->throw("Unable to acquire the lock ".$self->{lock_file}.": $!"); } =head2 Internal methods --- a/Koha/SearchEngine/Elasticsearch/Indexer.pm +++ a/Koha/SearchEngine/Elasticsearch/Indexer.pm @@ -226,7 +226,7 @@ sub index_status { INDEX_STATUS_RECREATE_REQUIRED, ) ) { - Koha::Exceptions::Exception->throw("Invalid index status: $status"); + Koha::Exception->throw("Invalid index status: $status"); } C4::Context->set_preference($key, $status); return $status; @@ -263,7 +263,7 @@ sub update_mappings { $self->set_index_status_recreate_required(); my $reason = $_[0]->{vars}->{body}->{error}->{reason}; my $index_name = $self->index_name; - Koha::Exceptions::Exception->throw( + Koha::Exception->throw( error => "Unable to update mappings for index \"$index_name\". Reason was: \"$reason\". Index needs to be recreated and reindexed", ); }; --- a/admin/smart-rules.pl +++ a/admin/smart-rules.pl @@ -22,7 +22,7 @@ use CGI qw ( -utf8 ); use C4::Context; use C4::Output qw( output_html_with_http_headers ); use C4::Auth qw( get_template_and_user ); -use Koha::Exceptions::Exception; +use Koha::Exception; use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Database; use Koha::Logger; @@ -462,7 +462,7 @@ elsif ( $op eq "add-open-article-requests-limit" ) { my $categorycode = $input->param('categorycode'); my $open_article_requests_limit = strip_non_numeric( scalar $input->param('open_article_requests_limit') ); - Koha::Exceptions::Exception->throw("No value passed for article request limit") + Koha::Exception->throw("No value passed for article request limit") if not defined $open_article_requests_limit # There is a JS check for that || $open_article_requests_limit eq ''; @@ -536,7 +536,7 @@ elsif ( $op eq "set-article-request-fee" ) { my $category = $input->param('article_request_fee_category'); my $fee = strip_non_numeric( scalar $input->param('article_request_fee') ); - Koha::Exceptions::Exception->throw("No value passed for article request fee") + Koha::Exception->throw("No value passed for article request fee") if not defined $fee # There is a JS check for that || $fee eq ''; --- a/t/db_dependent/Koha/BackgroundJobs/BatchUpdateBiblio.t +++ a/t/db_dependent/Koha/BackgroundJobs/BatchUpdateBiblio.t @@ -26,7 +26,7 @@ use JSON qw( encode_json decode_json ); use Koha::Database; use Koha::BackgroundJobs; use Koha::BackgroundJob::BatchUpdateBiblio; -use Koha::Exceptions::Exception; +use Koha::Exception; use t::lib::TestBuilder; my $schema = Koha::Database->new->schema; @@ -40,7 +40,7 @@ subtest "Exceptions must be stringified" => sub { my $C4_biblio_module = Test::MockModule->new('C4::Biblio'); $C4_biblio_module->mock( 'ModBiblio', - sub { Koha::Exceptions::Exception->throw("It didn't work"); } ); + sub { Koha::Exception->throw("It didn't work"); } ); my $biblio = $builder->build_sample_biblio; my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); --- a/t/db_dependent/Koha/Biblio.t +++ a/t/db_dependent/Koha/Biblio.t @@ -29,7 +29,7 @@ use Koha::Acquisition::Orders; use Koha::AuthorisedValueCategories; use Koha::AuthorisedValues; use Koha::MarcSubfieldStructures; -use Koha::Exceptions::Exception; +use Koha::Exception; use MARC::Field; use MARC::Record; @@ -544,7 +544,7 @@ subtest 'get_marc_components() tests' => sub { $search_mod->unmock( 'simple_search_compat'); $search_mod->mock( 'simple_search_compat', - sub { Koha::Exceptions::Exception->throw("error searching analytics") } + sub { Koha::Exception->throw("error searching analytics") } ); warning_like { $components = $host_biblio->get_marc_components } qr{^Warning from simple_search_compat: 'error searching analytics'}; --- a/t/db_dependent/Koha/Object.t +++ a/t/db_dependent/Koha/Object.t @@ -329,7 +329,7 @@ subtest "to_api() tests" => sub { $new_biblio_api = $new_biblio->to_api( { embed => { 'items' => { children => { asd => {} } } } } ); } - 'Koha::Exceptions::Exception', + 'Koha::Exception', "An exception is thrown if a blessed object to embed doesn't implement to_api"; is( --- a/t/db_dependent/api/v1/unhandled_exceptions.t +++ a/t/db_dependent/api/v1/unhandled_exceptions.t @@ -53,7 +53,7 @@ subtest 'unhandled_exception() tests' => sub { my $message = 'delete died'; my $mock_patron = Test::MockModule->new('Koha::Patron'); - $mock_patron->mock( 'delete', sub { Koha::Exceptions::Exception->throw($message); } ); + $mock_patron->mock( 'delete', sub { Koha::Exception->throw($message); } ); my $patron = $builder->build_object({ class => 'Koha::Patrons' }); --- a/t/lib/plugins/Koha/Plugin/Test.pm +++ a/t/lib/plugins/Koha/Plugin/Test.pm @@ -3,7 +3,7 @@ package Koha::Plugin::Test; ## It's good practice to use Modern::Perl use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Koha::Plugins::Tab; use Mojo::JSON qw( decode_json ); @@ -99,13 +99,13 @@ sub item_barcode_transform { if ( Scalar::Util::looks_like_number( $$barcode ) ) { $$barcode = $$barcode * 2 } - Koha::Exceptions::Exception->throw("item_barcode_transform called with parameter: $param"); + Koha::Exception->throw("item_barcode_transform called with parameter: $param"); } sub patron_barcode_transform { my ( $self, $barcode ) = @_; $$barcode //= ''; - Koha::Exceptions::Exception->throw("patron_barcode_transform called with parameter: $$barcode"); + Koha::Exception->throw("patron_barcode_transform called with parameter: $$barcode"); } sub configure { @@ -144,7 +144,7 @@ sub api_namespace { sub after_hold_create { my ( $self, $param ) = @_; - Koha::Exceptions::Exception->throw("after_hold_create called with parameter " . ref($param) ); + Koha::Exception->throw("after_hold_create called with parameter " . ref($param) ); } sub after_biblio_action { @@ -154,10 +154,10 @@ sub after_biblio_action { my $biblio_id = $params->{biblio_id}; if ( $action ne 'delete' ) { - Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, ref: " . ref($biblio) ); + Koha::Exception->throw("after_biblio_action called with action: $action, ref: " . ref($biblio) ); } else { - Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, id: $biblio_id") if $biblio_id; + Koha::Exception->throw("after_biblio_action called with action: $action, id: $biblio_id") if $biblio_id; } } @@ -170,12 +170,12 @@ sub after_item_action { if ( $action ne 'delete' ) { my $itemnumber_defined = (defined $item->itemnumber) ? 'yes' : 'no'; my $item_id_defined = (defined $item_id) ? 'yes' : 'no'; - Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) . " ". + Koha::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) . " ". "item_id defined: $item_id_defined ". "itemnumber defined: $itemnumber_defined" ); } else { - Koha::Exceptions::Exception->throw("after_item_action called with action: $action, id: $item_id" ) if $item_id; + Koha::Exception->throw("after_item_action called with action: $action, id: $item_id" ) if $item_id; } } @@ -183,7 +183,7 @@ sub after_authority_action { my ( $self, $params ) = @_; my $action = $params->{action} // q{}; my $id = $params->{authority_id} // 0; - Koha::Exceptions::Exception->throw("after_authority_action called with action: $action, id: $id"); + Koha::Exception->throw("after_authority_action called with action: $action, id: $id"); } sub after_circ_action { @@ -196,13 +196,13 @@ sub after_circ_action { my $type = $payload->{type}; if ( $action eq 'renewal' ) { - Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout)); + Koha::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout)); } elsif ( $action eq 'checkout') { - Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout) . " type: $type"); + Koha::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout) . " type: $type"); } elsif ( $action eq 'checkin' ) { - Koha::Exceptions::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout)); + Koha::Exception->throw("after_circ_action called with action: $action, ref: " . ref($checkout)); } } --- a/t/lib/plugins/Koha/Plugin/TestItemBarcodeTransform.pm +++ a/t/lib/plugins/Koha/Plugin/TestItemBarcodeTransform.pm @@ -3,7 +3,7 @@ package Koha::Plugin::TestItemBarcodeTransform; ## It's good practice to use Modern::Perl use Modern::Perl; -use Koha::Exceptions::Exception; +use Koha::Exception; use Koha::Plugins::Tab; use Mojo::JSON qw( decode_json ); @@ -38,7 +38,7 @@ sub item_barcode_transform { if ( Scalar::Util::looks_like_number( $$barcode ) ) { $$barcode = $$barcode * 4 } - Koha::Exceptions::Exception->throw("item_barcode_transform called with parameter: $param"); + Koha::Exception->throw("item_barcode_transform called with parameter: $param"); } 1; --- a/tools/batchMod.pl +++ a/tools/batchMod.pl @@ -32,7 +32,7 @@ use Encode qw( encode_utf8 ); use Koha::Database; use Koha::DateUtils qw( dt_from_string ); -use Koha::Exceptions::Exception; +use Koha::Exception; use Koha::Biblios; use Koha::Items; use Koha::Patrons; --