Bug 17499: (follow-up) More explicit exceptions
authorLari Taskula <lari.taskula@hypernova.fi>
Wed, 4 Nov 2020 15:19:22 +0000 (15:19 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 12 Sep 2023 13:16:09 +0000 (10:16 -0300)
commita0e5f4e0d97eec2c13fb2825869fdacc259b01f2
treeb8cfb581d4a3071f2704dfe6a6e277ebb9fcb9e6
parent33aa562f793108ad752ee044f61580e17001b949
Bug 17499: (follow-up) More explicit exceptions

Adds and throws more detailed exceptions.

This is useful for APIs and generating translatable errors in GUI.

In short, replaces Koha::Exceptions::BadParameter with:

Koha::Exceptions::Patron::NotFound
Koha::Exceptions::Patron::Category
Koha::Exceptions::Patron::Category::NotFound
Koha::Exceptions::Patron::Message::Preference
Koha::Exceptions::Patron::Message::Preference::AttributeNotFound
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceOutOfRange
Koha::Exceptions::Patron::Message::Preference::DaysInAdvanceNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestNotAvailable
Koha::Exceptions::Patron::Message::Preference::DigestRequired
Koha::Exceptions::Patron::Message::Preference::EmailAddressRequired
Koha::Exceptions::Patron::Message::Preference::NoTransportType
Koha::Exceptions::Patron::Message::Preference::SMSNumberRequired

To test:
1. prove t/db_dependent/Koha/Patron/Message/Preferences.t

Sponsored-by: The National Library of Finland
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Exceptions/Patron.pm
Koha/Exceptions/Patron/Category.pm [new file with mode: 0644]
Koha/Exceptions/Patron/Message/Preference.pm [new file with mode: 0644]
Koha/Exceptions/Patron/Message/Transport.pm [new file with mode: 0644]
Koha/Patron/Message/Preference.pm
t/db_dependent/Koha/Patron/Message/Preferences.t