@@ -, +, @@ --- Koha/Exceptions.pm | 9 +++++++++ Koha/Exceptions/Authentication.pm | 21 +++++++++++++++++++++ Koha/Exceptions/Authorization.pm | 18 ++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 Koha/Exceptions/Authentication.pm create mode 100644 Koha/Exceptions/Authorization.pm --- a/Koha/Exceptions.pm +++ a/Koha/Exceptions.pm @@ -9,6 +9,11 @@ use Exception::Class ( description => 'Something went wrong!', }, + 'Koha::Exceptions::BadParameter' => { + isa => 'Koha::Exceptions::Exception', + description => 'Bad parameter was given', + fields => ["parameter"], + }, 'Koha::Exceptions::DuplicateObject' => { isa => 'Koha::Exceptions::Exception', description => 'Same object already exists', @@ -21,6 +26,10 @@ use Exception::Class ( isa => 'Koha::Exceptions::Exception', description => 'A required parameter is missing' }, + 'Koha::Exceptions::UnderMaintenance' => { + isa => 'Koha::Exceptions::Exception', + description => 'Koha is under maintenance.' + }, # Virtualshelves exceptions 'Koha::Exceptions::Virtualshelves::DuplicateObject' => { isa => 'Koha::Exceptions::DuplicateObject', --- a/Koha/Exceptions/Authentication.pm +++ a/Koha/Exceptions/Authentication.pm @@ -0,0 +1,21 @@ +package Koha::Exceptions::Authentication; + +use Modern::Perl; + +use Exception::Class ( + + 'Koha::Exceptions::Authentication' => { + description => 'Something went wrong!', + }, + 'Koha::Exceptions::Authentication::Required' => { + isa => 'Koha::Exceptions::Authentication', + description => 'Authentication required' + }, + 'Koha::Exceptions::Authentication::SessionExpired' => { + isa => 'Koha::Exceptions::Authentication', + description => 'Session has been expired', + }, + +); + +1; --- a/Koha/Exceptions/Authorization.pm +++ a/Koha/Exceptions/Authorization.pm @@ -0,0 +1,18 @@ +package Koha::Exceptions::Authorization; + +use Modern::Perl; + +use Exception::Class ( + + 'Koha::Exceptions::Authorization' => { + description => 'Something went wrong!', + }, + 'Koha::Exceptions::Authorization::Unauthorized' => { + isa => 'Koha::Exceptions::Authorization', + description => 'Unauthorized', + fields => ['required_permissions'] + }, + +); + +1; --