Bug 36421: Make sure pre-controller errors are correctly logged
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 27 Mar 2024 12:29:31 +0000 (12:29 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 28 May 2024 16:24:10 +0000 (16:24 +0000)
commit88757883797c1e24f14fa3f0bf5c96fa6373eda7
tree02fc24106c4da7e1dfb812ab82cbb27ab9f2923e
parenta388b465180369087419c55994c8c7d6f22f90ad
Bug 36421: Make sure pre-controller errors are correctly logged

If something explodes in Koha::REST::V1::Auth chances are that no logging will happen.

This patch makes sure they are!

To test:
1. Make sure you do NOT have 36420 on your tree
2. Make sure you are looking at the logs:
   $ ktd --shell
  k$ koha-plack --restart kohadev; tail -f /var/log/koha/kohadev/*.log
3. Use Postman or similar for hitting some known endpoint. Use
   the user's cardnumber instead of the userid. On a default KTD launch, the
   generated user's cardnumber is '42'.
   GET /patrons
=> FAIL: You get a 500 error (expected, fixed on 36420) but no useful logging found.
4. Apply this patch
5. Ctrl+c on the logs and re-run the command
6. Repeat 3
=> SUCCESS: You get a 500, but you also get the exception information logged!
7. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
[OK] prove t/db_dependent/api/v1/items.t t/db_dependent/api/v1/unhandled_exceptions.t
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit e518e0be2c97782997037383223e57ce2e196df4)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 0705360fc8dd81f1c09e92859a200bb28c10c643)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/REST/Plugin/Exceptions.pm
Koha/REST/V1/Auth.pm