getErrorMessage() public method

Get the error message
public getErrorMessage ( ) : string
return string
Exemplo n.º 1
0
 /**
  * Set an error model and update some parts of the response object
  *
  * @param Model\Error $error An error model instance
  * @return Response
  */
 public function setError(Model\Error $error)
 {
     $errorMessage = $error->getErrorMessage();
     $this->headers->add(array('X-Imbo-Error-Message' => $errorMessage, 'X-Imbo-Error-InternalCode' => $error->getImboErrorCode(), 'X-Imbo-Error-Date' => $error->getDate()->format('D, d M Y H:i:s') . ' GMT'));
     $this->setStatusCode($error->getHttpCode(), $errorMessage)->setEtag(null)->setLastModified(null);
     $this->setModel($error);
     return $this;
 }
Exemplo n.º 2
0
Arquivo: JSON.php Projeto: ASP96/imbo
 /**
  * {@inheritdoc}
  */
 public function formatError(Model\Error $model)
 {
     $data = array('error' => array('code' => $model->getHttpCode(), 'message' => $model->getErrorMessage(), 'date' => $this->dateFormatter->formatDate($model->getDate()), 'imboErrorCode' => $model->getImboErrorCode()));
     if ($imageIdentifier = $model->getImageIdentifier()) {
         $data['imageIdentifier'] = $imageIdentifier;
     }
     return $this->encode($data);
 }
Exemplo n.º 3
0
Arquivo: XML.php Projeto: ASP96/imbo
    /**
     * {@inheritdoc}
     */
    public function formatError(Model\Error $model)
    {
        $imageIdentifierXml = '';
        if ($imageIdentifier = $model->getImageIdentifier()) {
            $imageIdentifierXml = '<imageIdentifier>' . $imageIdentifier . '</imageIdentifier>';
        }
        return <<<ERROR
<?xml version="1.0" encoding="UTF-8"?>
<imbo>
  <error>
    <code>{$model->getHttpCode()}</code>
    <message>{$model->getErrorMessage()}</message>
    <date>{$this->dateFormatter->formatDate($model->getDate())}</date>
    <imboErrorCode>{$model->getImboErrorCode()}</imboErrorCode>
  </error>
  {$imageIdentifierXml}
</imbo>
ERROR;
    }
Exemplo n.º 4
0
 /**
  * @covers Imbo\Model\Error::getErrorMessage
  * @covers Imbo\Model\Error::setErrorMessage
  */
 public function testCanSetAndGetErrorMessage()
 {
     $this->assertNull($this->model->getErrorMessage());
     $this->assertSame($this->model, $this->model->setErrorMessage('message'));
     $this->assertSame('message', $this->model->getErrorMessage());
 }