-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Love this name.. we need a hook named the same way (kidding) |
||
} | ||
|
||
$object_results = array(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -632,3 +632,26 @@ function islandora_solr_preprocess_islandora_objects_subset(&$variables) { | |
$variables['limit'] = $_islandora_solr_queryclass->solrLimit; | ||
} | ||
} | ||
|
||
/** | ||
* Make nice text for screen and log the exception to watchdog. | ||
* | ||
* @param \Exception $e | ||
* The exception. | ||
*/ | ||
function islandora_solr_technical_difficulties(Exception $e) { | ||
// Only report the error once per screen. | ||
$islandora_solr_error_reported = &drupal_static(__FUNCTION__, false); | ||
|
||
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 commentThe 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 |
||
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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. DOH! |
||
'@code' => $e->getCode(), | ||
'@message' => $e->getMessage(), | ||
'@file' => $e->getFile(), | ||
'@line' => $e->getLine(), | ||
), WATCHDOG_ERROR); | ||
$islandora_solr_error_reported = TRUE; | ||
} | ||
} |
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.