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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 76b984bb6c
)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
e1500c7c6b
commit
7a5d048b51
1 changed files with 7 additions and 1 deletions
|
@ -485,7 +485,13 @@ function filterDataTable( table, column, term ){
|
|||
}
|
||||
|
||||
jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
|
||||
console.warn(message);
|
||||
if ( settings.jqXHR ) {
|
||||
console.log("Got %s (%s)".format(settings.jqXHR.status, settings.jqXHR.statusText));
|
||||
alert(__("Something went wrong when loading the table.\n%s: %s").format(settings.jqXHR.status, settings.jqXHR.statusText));
|
||||
} else {
|
||||
alert(__("Something went wrong when loading the table."));
|
||||
}
|
||||
console.log(message);
|
||||
};
|
||||
|
||||
(function($) {
|
||||
|
|
Loading…
Reference in a new issue