[Bug 41696] New: Error handling in additem.pl is too specific and insufficient
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 Bug ID: 41696 Summary: Error handling in additem.pl is too specific and insufficient Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: tadeusz@sosnierz.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl additem.tt template "humanizes" every error it knows about, and ignores all others. This problem is noted in additem.pl itself (https://gitlab.com/koha-community/Koha/-/blob/166604f9f3938307de6ea5f2530b61...). The way it currently works is that any unhandled failure when adding/editing items fails quietly on the backend, but returns a 200 and shows a successful page to the user (a background job handling the same, but batched edit would fail visibly). The code and the template should be changed so that any caught exception leaves *some* trace in the interface and clearly indicates that an action has failed. (Patch incoming). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #1 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 191940 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191940&action=edit Bug 41696: Generalize additem.pl/tt's error handling This prevents us from losing track of errors and failing quietly. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191940|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #2 from HKS3 Tadeusz Sośnierz <tadeusz@sosnierz.com> --- Created attachment 192092 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192092&action=edit Bug 41696: Improve additem.pl/tt's error handling This prevents us from losing track of errors and failing quietly. Also gets rid of hardcoded error messages for Koha::Object exceptions, defering to full_message which provides more details. Sponsored-by: Universitätsbibliothek der Andrássy Universität -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@gmail.com --- Comment #3 from Jonathan Druart <jonathan.druart@gmail.com> --- 1. Missing filter [FAIL] koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt FAIL filters missing_filter at line 115 ( <strong>Error</strong>: [% error %].) 2. You need to keep the HTML tag around the error, or the translator script will add TT tag to the translations and it will be messy. 3. t/db_dependent/Koha/ApiKey.t and t/db_dependent/Koha/Object.t are failing, but I am expecting more 4. I've added a test to ApiKey and the result is a bit unexpected: # Failed test at t/db_dependent/Koha/ApiKey.t line 118. # got: 'Invalid parameter passed, patron_id= does not exist' # expected: 'Duplicate ID for key 'patron_id'' -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #4 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #3)
4. I've added a test to ApiKey and the result is a bit unexpected:
# Failed test at t/db_dependent/Koha/ApiKey.t line 118. # got: 'Invalid parameter passed, patron_id= does not exist' # expected: 'Duplicate ID for key 'patron_id''
Ha, it's actually the message added by your patch that is not accurate. 81 $msg = sprintf( "Invalid parameter passed, %s=%s does not exist", $self->broken_fk, $self->value ); Note that the test also raises a warning on this line: `Use of uninitialized value in sprintf at /kohadevbox/koha/Koha/Exceptions/Object.pm line 81.` -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #4)
(In reply to Jonathan Druart from comment #3)
4. I've added a test to ApiKey and the result is a bit unexpected:
# Failed test at t/db_dependent/Koha/ApiKey.t line 118. # got: 'Invalid parameter passed, patron_id= does not exist' # expected: 'Duplicate ID for key 'patron_id''
Ha, it's actually the message added by your patch that is not accurate.
81 $msg = sprintf( "Invalid parameter passed, %s=%s does not exist", $self->broken_fk, $self->value );
Note that the test also raises a warning on this line: `Use of uninitialized value in sprintf at /kohadevbox/koha/Koha/Exceptions/Object.pm line 81.`
Sorry, wrong exception, I was looking at the other one and mixed both! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #6 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 192317 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=192317&action=edit Bug 41696: Add a test Patch from commit ede59c5 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #7 from Jonathan Druart <jonathan.druart@gmail.com> --- Adjusted test, still failing # Failed test at t/db_dependent/Koha/ApiKey.t line 118. # got: 'Invalid parameter passed, patron_id= does not exist' # expected: 'Invalid parameter passed, patron_id=162 does not exist' -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41696 --- Comment #8 from Jonathan Druart <jonathan.druart@gmail.com> --- I do think the change is correct, and that we should have more description in our exceptions (i.e. more with full_message). However the patch is still not ready for inclusion. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org