Bug 29857: Rename base class as Koha::Exception

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomás Cohen Arazi 2022-01-31 11:02:41 -03:00 committed by Fridolin Somers
parent 7429f28cfc
commit 2b9fae5445
43 changed files with 110 additions and 110 deletions

View file

@ -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);

View file

@ -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";

View file

@ -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" );
}
};
}

View file

@ -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!"
},
);

View file

@ -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",
}
);

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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' => {

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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' => {

View file

@ -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 ) {

View file

@ -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 );
}
}

View file

@ -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

View file

@ -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",
);
};

View file

@ -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 '';

View file

@ -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' } );

View file

@ -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;
@ -541,7 +541,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'};

View file

@ -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(

View file

@ -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' });

View file

@ -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));
}
}

View file

@ -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;

View file

@ -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;