public function testBasicInitialization() { $sMessage = uniqid('test:'); $iCode = HttpResponseType::INTERNAL_ERROR; $o = new ExceptionResponseError($sMessage, $iCode); $this->assertEquals($sMessage, $o->getMessage()); $this->assertEquals($iCode, $o->getErrorCode()); }
public function setException(\Exception $e) { $this->exception = $e; $this->message = $e->getMessage(); if (ExceptionResponseError::isValid($e)) { /** @var ExceptionResponseError $e */ $this->error_code = $e->getErrorCode(); } }
public function __construct($iStatus, $sMessage = 'test') { parent::__construct($sMessage, $iStatus); }
<?php use vsc\presentation\responses\ExceptionResponseError; /* @var $model \vsc\domain\models\ErrorModel */ $t = array(); if (ExceptionResponseError::isValid($model->getException())) { $t['error_code'] = $model->getException()->getErrorCode(); // $t['error_message'] = $model->getException()->getErrorMessage(); } $t['message'] = $model->getMessage(); /* @var $this \vsc\presentation\views\JsonView */ echo $this->outputModel($t);