Bug 20272 - XSLT_Handler should use alphanumeric error codes
Summary: XSLT_Handler should use alphanumeric error codes
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
: 19018 (view as bug list)
Depends on:
Blocks: 24313
  Show dependency treegraph
 
Reported: 2018-02-22 13:45 UTC by Marcel de Rooy
Modified: 2019-12-27 13:50 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


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
Bug 20272: Replace error numbers by codes in XSLT_Handler (13.28 KB, patch)
2018-05-28 08:47 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 20272: Changes for Breeding.pm and Record.pm (7.50 KB, patch)
2018-05-28 08:47 UTC, Chris Cormack
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>
Comment 6 Chris Cormack 2018-05-28 08:47:32 UTC
Created attachment 75582 [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>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 7 Chris Cormack 2018-05-28 08:47:57 UTC
Created attachment 75583 [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'.

The bonus is these error messages are now translatable as they are in
the templates

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

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 8 Nick Clemens (kidclamp) 2018-07-02 13:17:03 UTC
Awesome work all!

Pushed to master for 18.11
Comment 9 Martin Renvoize (ashimema) 2018-07-02 17:19:04 UTC
Enhancement, not back porting to 18.05.x series.