Exemple #1
0
 /**
  * ErrorException constructor.
  *
  * @param ErrorResponse $errorResponse
  * @param mixed $extraInfo
  */
 public function __construct(ErrorResponse $errorResponse, $extraInfo = null)
 {
     $this->errorResponse = $errorResponse;
     $this->message = $this->errorResponse->__toString();
     $this->extraInfo = $extraInfo;
     if (is_array($extraInfo) && isset($extraInfo['query_string'])) {
         $this->message .= " while executing \"" . $extraInfo['query_string'] . "\"";
     }
 }
Exemple #2
0
 private function handleErrorResponse(ErrorResponse $message)
 {
     $this->lastError = $message;
     if ($message->getSeverity() == "FATAL") {
         $this->connStatus = $this::CONNECTION_BAD;
         // notify any waiting commands
         $this->processQueue();
     }
     if ($this->connStatus === $this::CONNECTION_MADE) {
         $this->connStatus = $this::CONNECTION_BAD;
         // notify any waiting commands
         $this->processQueue();
     }
     if ($this->currentCommand !== null) {
         $extraInfo = null;
         if ($this->currentCommand instanceof Sync) {
             $extraInfo = ["query_string" => $this->currentCommand->getDescription()];
         } elseif ($this->currentCommand instanceof Query) {
             $extraInfo = ["query_string" => $this->currentCommand->getQueryString()];
         }
         $this->currentCommand->getSubject()->onError(new ErrorException($message, $extraInfo));
         $this->currentCommand = null;
     }
 }