private function handleSolrError(Opus_SolrSearch_Exception $exception) { $this->_helper->layout()->enableLayout(); $this->getLogger()->err(__METHOD__ . ' : ' . $exception); if ($exception->isServerUnreachable()) { $e = new Application_Exception('error_search_unavailable'); $e->setHttpResponseCode(503); throw $e; } elseif ($exception->isInvalidQuery()) { $e = new Application_Exception('error_search_invalidquery'); $e->setHttpResponseCode(500); throw $e; } else { $e = new Application_Exception('error_search_unknown'); $e->setHttpResponseCode(500); throw $e; } }
/** * * @param Opus_SolrSearch_Exception $exception * @param boolean $usePlainMessage set to true if exception message should not be translated */ public function __construct($exception, $usePlainMessage = false) { parent::__construct($exception->getMessage(), $exception->getCode(), $exception->getPrevious()); if ($exception->isServerUnreachable()) { if ($usePlainMessage) { $this->message = 'search server is not responding -- try again later'; } else { $this->message = 'error_search_unavailable'; } $this->setHttpResponseCode(503); return; } if ($exception->isInvalidQuery()) { if ($usePlainMessage) { $this->message = 'search query is invalid -- check syntax'; } else { $this->message = 'error_search_invalidquery'; } $this->setHttpResponseCode(500); return; } if ($usePlainMessage) { $this->message = 'unknown error while executing search query'; } else { $this->message = 'error_search_unknown'; } $this->setHttpResponseCode(500); }