-
Notifications
You must be signed in to change notification settings - Fork 62
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
Print nice errors to the screen #362
Conversation
// Islandora: dump solr query address in debug mode | ||
if (variable_get('islandora_solr_debug_mode', 0) && user_access('view islandora solr debug')) { | ||
drupal_set_message(l('solr query',$url."&indent=on&debugQuery=true")); | ||
} | ||
//$http_response_header is set by file_get_contents | ||
$response = new Apache_Solr_Response(@file_get_contents($url, false, $this->_getContext), $http_response_header, $this->_createDocuments, $this->_collapseSingleValueArrays); | ||
$response = new Apache_Solr_Response(@file_get_contents($url, false, $this->_getContext), @$http_response_header, $this->_createDocuments, $this->_collapseSingleValueArrays); |
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.
Wuhu! so you are editing the Client =) This opens a lot of possibilities ++
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 wasn't going to, but then I saw that islandora_solr_debug_mode
block above. Also I have given up replacing this client, easier to fix it in Islandora 8.
@@ -399,7 +399,7 @@ class IslandoraSolrQueryProcessor { | |||
$results = $solr->search($solr_query, $this->solrStart, $this->solrLimit, $this->solrParams, $method); | |||
} | |||
catch (Exception $e) { | |||
drupal_set_message(check_plain(t('Error searching Solr index')) . ' ' . $e->getMessage(), 'error'); | |||
islandora_solr_technical_difficulties($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.
Love this name.. we need a hook named the same way (kidding)
islandora_solr.module
Outdated
if ($islandora_solr_error_reported !== true) { | ||
$message = "We are experiencing technical difficulties at this time and are working to fix the problem. Please try back later."; | ||
drupal_set_message(t($message), 'warning'); | ||
watchdog("manidora", "Received exception @code: @message\nLine: @line in file: @file", array( |
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.
Manidora?
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.
DOH!
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.
Just the manidora piece. Rest looks good
islandora_solr.module
Outdated
|
||
if ($islandora_solr_error_reported !== true) { | ||
if ($islandora_solr_error_reported !== TRUE) { | ||
$message = "We are experiencing technical difficulties at this time and are working to fix the problem. Please try back later."; |
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.
Final request. Could we have a way of customizing this message? Since it's front facing.. i know i know we did not have it before so why now? Because people i know will ask for it for sure.. maybe a hook-ie? i mean, its not a blocker... since you can always disable reporting at all...but could be cool? sorry
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 looks great. What better reason to catch exceptions than actually letting them to be thrown! Good, good.
PHP 5.3.3 holding on to the buggy so your electric car moves very slowly. |
Restarting the test, error is of type "HttpConnectionException' with message" so not DCS... i guess |
@DiegoPino I've restarted it a couple times and it always seems to fail when setting up Islandora/Fedora |
If i was release manager i would say lets merge this anyway in 24 hours. I'm a bit done with travis.... |
Perhaps (😬) it is time (again) to consider shifting PHP 5.3.3 to an allowed failure. |
So.. seems still failing. Should i merge??? |
@DiegoPino this is on the agenda for a TAG meeting on Friday, why don't we hold off until then. |
Closing in favour of #363 |
JIRA Ticket: https://jira.duraspace.org/browse/ISLANDORA-2419
What does this Pull Request do?
Captures the Exception thrown from SolrPhpClient and logs it to watchdog instead of printing it to the screen. Then it presents a simple text message.
What's new?
There is a variable in the SolrPhpClient set based on the response from Solr, if Solr is shut down this displays a NOTICE. So I silenced that. Made a small function to help aggregate multiple error messages into a single message on screen and in the log. Also removed some extraneous try {} catch blocks (which I didn't realize where useless as the Exception was caught in the query_processor)
How should this be tested?
Turn off your Solr and use Islandora, go to Search pages, etc.
See the large red Exception text.
Pull in this PR.
See the nice yellow warning text, check your log for the Exception text.
Additional Notes:
Example:
Interested parties
@Islandora/7-x-1-x-committers