Bug 20272 - XSLT_Handler should use alphanumeric error codes
Summary: XSLT_Handler should use alphanumeric error codes
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
: 19018 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-22 13:45 UTC by Marcel de Rooy
Modified: 2018-03-15 10:02 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 20272: Replace error numbers by codes in XSLT_Handler (13.20 KB, patch)
2018-02-26 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 20272: Changes for Breeding.pm and Record.pm (7.34 KB, patch)
2018-02-26 13:50 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 20272: Replace error numbers by codes in XSLT_Handler (13.23 KB, patch)
2018-03-15 10:02 UTC, Brendan Gallagher
Details | Diff | Splinter Review
Bug 20272: Changes for Breeding.pm and Record.pm (7.37 KB, patch)
2018-03-15 10:02 UTC, Brendan Gallagher
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2018-02-22 13:45:05 UTC
Currently, the code uses error numbers 1 to 7.
The method errstr is not widely used.
In order to translate error message, we could use a template.
Comment 1 Marcel de Rooy 2018-02-22 13:49:22 UTC
*** Bug 19018 has been marked as a duplicate of this bug. ***
Comment 2 Marcel de Rooy 2018-02-26 13:50:18 UTC
Created attachment 72205 [details] [review]
Bug 20272: Replace error numbers by codes in XSLT_Handler

We remove the error numbers 1 to 7 by readable codes.
And remove the errstr attribute (not used widely).
Make XSLT_Handler a little bit less noisy by defaulting print_warns to
false unless $ENV{DEBUG} is set. (See also bug 19018).

The unit has been changed accordingly.
(A few warnings are no longer tested.)

Test plan:
Run t/db_dependent/XSLT_Handler.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2018-02-26 13:50:24 UTC
Created attachment 72206 [details] [review]
Bug 20272: Changes for Breeding.pm and Record.pm

In Breeding.pm we let Z3950Search return the xslt handler error codes back
to the template. They are converted to text messages by using an new include
file (added for opac and intranet now). The generic xslt_err code is now
obsoleted.

In Record.pm the errstr call is removed. The croak is done with the new
error code in err. This seems sufficient.

Test plan:
[1] Run Breeding.t
[2] Run Record.t
[3] Add a nonexisting xslt file to one of your Z3950 targets. Search on that
    target and check if you see a error 'XSLT file not found'.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Brendan Gallagher 2018-03-15 10:02:45 UTC
Created attachment 72916 [details] [review]
Bug 20272: Replace error numbers by codes in XSLT_Handler

We remove the error numbers 1 to 7 by readable codes.
And remove the errstr attribute (not used widely).
Make XSLT_Handler a little bit less noisy by defaulting print_warns to
false unless $ENV{DEBUG} is set. (See also bug 19018).

The unit has been changed accordingly.
(A few warnings are no longer tested.)

Test plan:
Run t/db_dependent/XSLT_Handler.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 5 Brendan Gallagher 2018-03-15 10:02:56 UTC
Created attachment 72917 [details] [review]
Bug 20272: Changes for Breeding.pm and Record.pm

In Breeding.pm we let Z3950Search return the xslt handler error codes back
to the template. They are converted to text messages by using an new include
file (added for opac and intranet now). The generic xslt_err code is now
obsoleted.

In Record.pm the errstr call is removed. The croak is done with the new
error code in err. This seems sufficient.

Test plan:
[1] Run Breeding.t
[2] Run Record.t
[3] Add a nonexisting xslt file to one of your Z3950 targets. Search on that
    target and check if you see a error 'XSLT file not found'.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>