/** * * @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); }