From: Eric Merrill Date: Sun, 28 Feb 2016 18:40:25 +0000 (-0500) Subject: MDL-53271 search: Catch Solr Server errors when adding doc X-Git-Tag: v3.1.0-beta~399^2 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=63d5007b7799982535d0fa1ab765b20d5f4f015b MDL-53271 search: Catch Solr Server errors when adding doc --- diff --git a/search/engine/solr/classes/engine.php b/search/engine/solr/classes/engine.php index 1e45829519d..f7e6cb63524 100644 --- a/search/engine/solr/classes/engine.php +++ b/search/engine/solr/classes/engine.php @@ -309,6 +309,10 @@ class engine extends \core_search\engine { $result = $this->get_search_client()->addDocument($solrdoc, true, static::AUTOCOMMIT_WITHIN); } catch (\SolrClientException $e) { debugging('Solr client error adding document with id ' . $doc['id'] . ': ' . $e->getMessage(), DEBUG_DEVELOPER); + } catch (\SolrServerException $e) { + // We only use the first line of the message, as it's a fully java stacktrace behind it. + $msg = strtok($e->getMessage(), "\n"); + debugging('Solr server error adding document with id ' . $doc['id'] . ': ' . $msg, DEBUG_DEVELOPER); } }