Hmm. Not sure why it did not work? ->error and ->message should be interchangeable?
(In reply to Marcel de Rooy from comment #1) > Hmm. Not sure why it did not work? ->error and ->message should be > interchangeable? From Exception::Class::Base *error = \&message; AND my %p = @_ == 1 ? ( error => $_[0] ) : @_; $self->{message} = $p{message} || $p{error} || q{}; Will use this report for something else.
New title, new contents. The public endpoints now still return output while Maintenance is enabled.
Created attachment 159234 [details] [review] Bug 34999: Throw exception for public routes if OPACMaintenance is enabled Test plan: [1] Try public endpoint like /api/v1/public/biblios/X/items. * Replace X by an existing biblionumber. You should receive a 200. [2] Enable OPACMaintenance. Set to Show. [3] Try same endpoint. You should get a 503 with a json error. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Still needs a unit test.
TODO - return $c->render(status => 503, json => { error => $_->error }); + return $c->render(status => 503, json => { error => $_->message }); This is not needed.
Created attachment 159235 [details] [review] Bug 34999: Throw exception for public routes if OPACMaintenance is enabled Test plan: [1] Try public endpoint like /api/v1/public/biblios/X/items. * Replace X by an existing biblionumber. You should receive a 200. [2] Enable OPACMaintenance. Set to Show. [3] Try same endpoint. You should get a 503 with a json error. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 160828 [details] [review] Bug 34999: Throw exception for public routes if OPACMaintenance is enabled Test plan: [1] Try public endpoint like /api/v1/public/biblios/X/items. * Replace X by an existing biblionumber. You should receive a 200. [2] Enable OPACMaintenance. Set to Show. [3] Try same endpoint. You should get a 503 with a json error. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 160829 [details] [review] Bug 34999: Add unit test Test plan: Run t/db_dependent/api/v1/auth.t [Bonus] Run prove t/db_dependent/api/v1 Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Test Summary Report ------------------- t/db_dependent/api/v1/erm_counter_registries.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 t/db_dependent/api/v1/erm_sushi_services.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 t/db_dependent/api/v1/two_factor_auth.t (Wstat: 512 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 2 Parse errors: Bad plan. You planned 2 tests but ran 1. Files=67, Tests=380, 812 wallclock secs ( 0.75 usr 0.18 sys + 748.36 cusr 48.36 csys = 797.65 CPU) Result: FAIL So 3 tests failed. No problem however: Bug 35757 - Sushi service and counter registry tests are failing RESOLVES the first two failing tests. Adding an encryption key to koha_conf resolved the two_factor_auth.t failures.
Created attachment 160840 [details] [review] Bug 34999: Throw exception for public routes if OPACMaintenance is enabled Test plan: [1] Try public endpoint like /api/v1/public/biblios/X/items. * Replace X by an existing biblionumber. You should receive a 200. [2] Enable OPACMaintenance. Set to Show. [3] Try same endpoint. You should get a 503 with a json error. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 160841 [details] [review] Bug 34999: Add unit test Test plan: Run t/db_dependent/api/v1/auth.t [Bonus] Run prove t/db_dependent/api/v1 Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 160973 [details] [review] Bug 34999: Throw exception for public routes if OPACMaintenance is enabled Test plan: [1] Try public endpoint like /api/v1/public/biblios/X/items. * Replace X by an existing biblionumber. You should receive a 200. [2] Enable OPACMaintenance. Set to Show. [3] Try same endpoint. You should get a 503 with a json error. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 160974 [details] [review] Bug 34999: Add unit test Test plan: Run t/db_dependent/api/v1/auth.t [Bonus] Run prove t/db_dependent/api/v1 Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Pushed for 24.05! Well done everyone, thank you!
Pushed to 23.11.x for 23.11.02
Needs some release notes
(In reply to Fridolin Somers from comment #17) > Needs some release notes Hmm. The title of this report tells mostly what it does. But I can add a few words that tell it again :)
Backported to 23.05.x for upcoming 23.05.09