-
Notifications
You must be signed in to change notification settings - Fork 95
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
Issuexxxx improve http error handling #1033
Conversation
…ch queries; fixes waypoint system used in search; added checks for various easyrdf http client errors
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
if ($this->model->getConfig()->getLogCaughtExceptions()) { | ||
error_log('Caught exception: ' . $e->getMessage()); | ||
} | ||
return null; |
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.
Is this ok?
Codecov Report
@@ Coverage Diff @@
## master #1033 +/- ##
============================================
- Coverage 60.32% 59.67% -0.66%
- Complexity 1593 1612 +19
============================================
Files 32 32
Lines 4429 4484 +55
============================================
+ Hits 2672 2676 +4
- Misses 1757 1808 +51
Continue to review full report at Codecov.
|
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.
Bundling so many fixes into a single PR makes it very difficult to review. Could you please split this into smaller, more focused PRs?
Thank you for your valuable feedback @osma . I just gave a quick look at this draft PR after it has been a while since I made this and it seemed like that except for the waypoint fixes (that just happened to annoy me at the time of building this PR up) and #1011-related part (which has been by the way fixed in another commit already (now) residing in the master branch) this PR truly fixes (or at least tries to fix, as it says on the PR comment, there are still things to be done) one big problem that has just been reported in multiple places - well OK, to be honest, one could separate most UI fixes into their own PR but then again - they depend on this PR as this changes the way they (that is to say, UI) expect issues are passed down (catching them). One can, of course, drop them from this PR (which may, by the way, cause other hassle as the UI is not prepared for aforementioned changes) but I personally think this is a matter of personal preference for how to test that things truly are working in the very UI without writing the unit tests first. Anyways, anything needed for a successful review is there in the PR comment - after all, this is a draft PR and some comments are appreciated and very much needed (see the list of TODOs/open questions) in order to finish this PR. |
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.
I gave some quick comments.
The biggest problem ATM is the conflicts that should be resolved before this PR can even be tested with the code in current master
.
<div class="alert alert-warning"> | ||
{% for voc in skipped_vocabs %} | ||
{% set vocTitle = voc.title %} | ||
<h4>{% trans %}Warning: Skipped searching from '{{vocTitle}}' vocabulary!{% endtrans %}</h4> |
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.
We need translations for this new UI string
<h4>{% trans %}Error: Requested vocabulary not found!{% endtrans %}</h4> | ||
{% else %} | ||
<h4>{% trans %}Error: Search failed!{% endtrans %}</h4> |
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.
We need translations for this new UI string
{% set vocabInfo = vocab.info(request.contentLang) %} | ||
{% if not vocabInfo %} | ||
<div class="alert alert-danger" role="alert"> | ||
{% trans "Error: Failed to retrieve vocabulary information!" %} |
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.
We need translations for this new UI string
}, | ||
error: function(jqXHR, textStatus, errorThrown) { | ||
$loading.detach(); | ||
var $failedSearch = $('<div class="alert alert-danger"><h4>Error: Loading for more items failed!</h4></div>'); |
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.
This error message should be translated
error: function(jqXHR, textStatus, errorThrown) { | ||
$loading.detach(); | ||
var $failedSearch = $('<div class="alert alert-danger"><h4>Error: Loading for more items failed!</h4></div>'); | ||
var $retryButton = $('<button class="btn btn-default" type="button">Retry</button>'); |
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.
"Retry" should be translated as well
$vocabObjects[] = $this->model->getVocabulary($vocid); | ||
try { | ||
$vocabObjects[] = $this->model->getVocabulary($vocid); | ||
} catch (Exception $e) { |
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.
An empty catch block is bad practice. What happens with the $vocabObjects
variable that is used below?
At a minimum, it could be set to null
here, or array()
if that makes more sense.
It's not possible to do proper review on this PR as it mixes up so many different fixes - and it's even more difficult now that the branch has diverged from master and ended up in conflicted state. I will split this into separate branches (mainly by commits) and open PRs for each of them. |
I've now disentangled most of the changes included in this PR into separate PRs:
I think these can be handled separately in those PRs. What remains is the last commit (so far) in this PR 9f762ff which is itself a bundle of several fixes in a single commit, and it seems that it may rely on changes done in the previous commits, so cannot easily be separated. I think the above PRs should be merged first and then the remaining commit can be dealt with. |
The remaining parts of this PR (well, except the message about skipped vocabularies, which was deemed too obtrusive) have been merged via PR #1197. Closing this one. |
This PR fixes a bunch or problems in current code.
Fixes the following listed issues:
Fixes #693
Fixes #721
Fixes #722
Fixes #723
Fixes #1011
Addresses #759 in the sense that it could be implemented in a similar way (add a retry button/handle ajax failure)
Adds PHP fatal error checks for various easyrdf http client induced errors. E.g., doesn't crash the UI in the usual cases for a non-responding SPARQL endpoint (some may still exist).
Global search: adds a warning for every selected, non-default endpoint vocabularies.
Searches may now return 500 Internal Server Error, which on turn is utilized by Ajax queries. Please note that not every failure results in an HTTP 500 Error.
Waypoint system in searches is fixed; no more extra requests.
TODO/open questions: