/** * @return array */ protected function exceptionToArray() { $error = ['code' => trim($this->getExceptionErrorCode(Error::CODE_GENERAL, 'Exception'), '.'), 'message' => $this->exception->getMessage()]; if ($this->exception instanceof FormValidationException) { $error['code'] = $this->exception->getCode(); $error['fields'] = $this->exception->getFieldErrors(); } elseif ($this->exception instanceof HttpException) { $error['code'] = $this->getExceptionErrorCode(Error::CODE_HTTP, 'HttpException'); } return $error; }