Bug 31138

Summary: DataTables is not raising error to the end user
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Staff interfaceAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Kyle M Hall (khall) <kyle>
Severity: major    
Priority: P5 - low CC: gmcharlt, kyle, lucas, martin.renvoize, tomascohen, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.05, 21.11.12, 21.05.19
Circulation function:
Bug Depends on:    
Bug Blocks: 31269, 31343    
Attachments: Bug 31138: Don't ignore DataTables errors and raise them to the end-user
Bug 31138: Don't ignore DataTables errors and raise them to the end-user
Bug 31138: Don't ignore DataTables errors and raise them to the end-user

Description Jonathan Druart 2022-07-12 08:08:13 UTC
DataTables is not raising error to the end user, it's only displaying a generic message in the console.
This leads to lot of questions on IRC or the mailing list ("the table is empty").
We can do better and display what went wrong.

We could also imagine add a link to the wiki for the more common problems (won't be implemented here however).
Comment 1 Jonathan Druart 2022-07-12 08:12:07 UTC
Created attachment 137609 [details] [review]
Bug 31138: Don't ignore DataTables errors and raise them to the end-user

DataTables is not raising error to the end user, it's only displaying a generic message in the console.
This leads to lot of questions on IRC or the mailing list ("the table is empty").
We can do better and display what went wrong.

We could also imagine add a link to the wiki for the more common problems (won't be implemented here however).

Test plan:
Revert "Bug 31104: Put each link on a separate header" and search for a
patron using a very long string
You should get an alert with the reponse of the server.
In my case:
"""
Something went wrong when loading the table.
414: Request-URI Too Long
"""

You can also make the REST API returns a 500 (bad specs or simply with a
die statement).
Comment 2 Martin Renvoize (ashimema) 2022-07-12 09:45:36 UTC
Created attachment 137615 [details] [review]
Bug 31138: Don't ignore DataTables errors and raise them to the end-user

DataTables is not raising error to the end user, it's only displaying a generic message in the console.
This leads to lot of questions on IRC or the mailing list ("the table is empty").
We can do better and display what went wrong.

We could also imagine add a link to the wiki for the more common problems (won't be implemented here however).

Test plan:
Revert "Bug 31104: Put each link on a separate header" and search for a
patron using a very long string
You should get an alert with the reponse of the server.
In my case:
"""
Something went wrong when loading the table.
414: Request-URI Too Long
"""

You can also make the REST API returns a 500 (bad specs or simply with a
die statement).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize (ashimema) 2022-07-12 09:47:28 UTC
Works as designed.. signing off.

We could go a little further and grab our API error messages from 'responseJSON'.. but I'm not sure if would yield any better results in terms of people coming and asking for help.. we're still likely to need to ask for more details to really investigate any problems and as such direct them at the console and networking log to get those details anyway.
Comment 4 Kyle M Hall (khall) 2022-07-22 14:32:04 UTC
Created attachment 138030 [details] [review]
Bug 31138: Don't ignore DataTables errors and raise them to the end-user

DataTables is not raising error to the end user, it's only displaying a generic message in the console.
This leads to lot of questions on IRC or the mailing list ("the table is empty").
We can do better and display what went wrong.

We could also imagine add a link to the wiki for the more common problems (won't be implemented here however).

Test plan:
Revert "Bug 31104: Put each link on a separate header" and search for a
patron using a very long string
You should get an alert with the reponse of the server.
In my case:
"""
Something went wrong when loading the table.
414: Request-URI Too Long
"""

You can also make the REST API returns a 500 (bad specs or simply with a
die statement).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Tomás Cohen Arazi (tcohen) 2022-07-22 17:52:41 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass (lukeg) 2022-09-02 15:12:50 UTC
Backported to 22.05.x for 22.05.05
Comment 7 Arthur Suzuki 2022-09-14 12:59:13 UTC
Thanks!

Pushed to 21.11 for 21.11.12
Comment 8 Victor Grousset/tuxayo 2022-09-19 21:45:40 UTC
Backported: Pushed to 21.05.x branch for 21.05.19