-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the cleanup
@hannahbast I believe we should discuss this 1:1. A lot of my coding decisions boil down to correcting execution order after using await and preventing so called "unhandled promise rejections" which occur when a promise is rejected somewhere without a catch or something. While browsers typically log such events it's better to explicitly handle this case, which is why you see all the "catch()" snippets throughout the codebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1-1 with Robin, with minor change requests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
@RobinTF This query used to give a proper error message (the error message from QLever), now it just says "400 Bad Request" https://qlever.cs.uni-freiburg.de/wikidata/MCyZeF |
@hannahbast Should be fixed now |
@RobinTF Awesome, thanks for the quick reaction, I updated the QLever UI instance and now we get a nice error message again: https://qlever.cs.uni-freiburg.de/wikidata/MCyZeF |
@RobinTF: We have to check the error handling again. I deliberately crashed https://qlever.cs.uni-freiburg.de/dblp . Now if you launch a query, you get
Below is the full reply the Qlever UI gets (from the proxy in front of the backend) [1]. The error message used to be:
That message was in the part, which you deleted: https://github.com/ad-freiburg/qlever-ui/blob/master/backend/static/js/qleverUI.js#L659 . And I now remember that it took some work to get it, but I forgot all the details. [1] Full reply with headers:
|
@hannahbast I added some changes that should make the error message nicer. Note that I deliberately changed the wording because technically at this point we got a response (if we have no internet connection we'll get a network error instead), we just realize that it's not valid JSON and inform the user about the fact that the response was not what we expected. |
fetch
instead of jQuery.ajax
478d63f
to
44a9feb
Compare
fetch
instead of jQuery.ajax
fetch
when speaking with the QLever backend
fetch
when speaking with the QLever backendfetch
for queries
fetch
for queriesfetch
+ improve error messages
fetch
+ improve error messages fetch
+ improve error handling
@RobinTF I have merged this now, thanks a lot for your work! |
The JavaScript code of the QLever UI launches queries at many places (to get a query result, to get suggestions, to clear the cache, to get statistics, to get a share link, etc.). In the code so far, each request did this slightly differently. This is now unified as much as possible. In particular, all requests now use
fetch
and none of the requests usejQuery.ajax
anymore.Along the way, remove code that is no longer needed (like the code that realized SERVICE in the JavaScript) and improve the error messages when something goes wrong.