Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently use fetch + improve error handling #69

Merged
merged 27 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
53b8358
Replace $.ajax with calls to the fetch API and clean up codebase
RobinTF Nov 25, 2023
570a142
Replace usages of %.post with fetch
RobinTF Nov 25, 2023
4e593be
Replace $.getJSON with fetch
RobinTF Nov 25, 2023
1508b6b
Add back missing variable
RobinTF Nov 25, 2023
6c31d20
Add let to variable declaration
RobinTF Nov 27, 2023
ae1d112
Remove redundant content-type declaration
RobinTF Nov 27, 2023
ee5a331
Add documentation and convert let to const
RobinTF Dec 2, 2023
b6cbd5d
Fix typo
RobinTF Dec 2, 2023
e691d2d
Fix bad error handling
RobinTF Dec 2, 2023
a398771
Remove redundant semicolon
RobinTF Dec 2, 2023
6ba8c1e
Use nicer error message if JSON cannot be parsed
RobinTF Dec 3, 2023
1e5b229
Fine tune error message
RobinTF Dec 3, 2023
bb4ce7d
Fix double encoding
RobinTF Dec 9, 2023
66ab63b
Make use of POST body
RobinTF Dec 9, 2023
fd3af60
Remove redundant code
RobinTF Dec 9, 2023
26c87e1
Only pass error message to log
RobinTF Dec 9, 2023
823c3b8
Largely unify error handling
RobinTF Dec 9, 2023
1603983
Fix duplicate handler registration
RobinTF Dec 9, 2023
5d9c6ed
Merge remote-tracking branch 'ad-freiburg/master' into migrate-to-fetch
RobinTF Dec 10, 2023
249682a
Small formatting changes
RobinTF Dec 10, 2023
84b4589
Change error message for HTTP 502, 503, or 504
Dec 11, 2023
e87cb64
Run catch block if stats request is unsuccessful
RobinTF Dec 11, 2023
44a9feb
Fix problem with cmd=stats + improve error message
Dec 11, 2023
62450d8
Properly propagate AbortErrors
RobinTF Dec 11, 2023
117ad82
Fix invalid JSON error handling
RobinTF Dec 11, 2023
f240d52
Add back accept header
RobinTF Dec 13, 2023
f285d8d
Use qlever-flavour JSON
RobinTF Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions backend/static/js/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,13 @@ function expandEditor() {
}
}

function displayError(response, statusWithText = undefined, queryId = undefined) {
function displayError(response, queryId = undefined) {
console.error("Either the GET request failed or the backend returned an error:", response);
if (response["exception"] == undefined || response["exception"] == "") {
response["exception"] = "Unknown error";
}
disp = "<h4><strong>Error processing query</strong></h4>";
// if (statusWithText) { disp += "<p>" + statusWithText + "</p>"; }
disp += "<p>" + htmlEscape(response["exception"]) + "</p>";
// if (result["Exception-Error-Message"] == undefined || result["Exception-Error-Message"] == "") {
// result["Exception-Error-Message"] = "Unknown error";
// }
// disp = "<h3>Error:</h3><h4><strong>" + result["Exception-Error-Message"] + "</strong></h4>";
// The query sometimes is a one-element array with the query TODO: find out why.
if (Array.isArray(response.query)) {
if (response.query.length >= 1) { response.query = response.query[0]; }
Expand Down Expand Up @@ -816,18 +811,6 @@ function displayStatus(str) {
$("#infoBlock").show();
}

// This is used only in commented out code in the function `processQuery` in
// `qleverUI.js`.
function showAllConcatsDeprecated(element, sep, column) {
data = $(element).parent().data('original-title');
html = "";
results = data.split(sep);
for (var k = 0; k < results.length; k++) {
html += getFormattedResultEntry(results[k], 50, column)[0] + "<br>";
}
$(element).parent().html(html);
}

function tsep(str) {
var spl = str.toString().split('.');
var intP = spl[0];
Expand Down
Loading