/** * @param Exception $e * @param int $httpCode * @param null|array $headers * * @throws HTTP_Exception_Redirect */ public static function exception(Exception $e, $httpCode = 500, $headers = NULL) { if ($e instanceof HTTP_Exception_Redirect) { throw $e; } if ($e instanceof HTTP_Exception) { $httpCode = $e->getCode(); } self::json(Helpers_Arr::exception($e), $httpCode, $headers); }
/** * @param Exception $e * * @return array|null */ public static function exception(Exception $e = NULL) { if ($e instanceof Exception) { $data = ['message' => Helpers_Text::trimAsNULL($e->getMessage()), 'code' => $e->getCode()]; if (!Kohana_Helpers_Core::isProduction()) { $data = Kohana_Helpers_Arr::merge($data, ['file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTrace(), 'previous' => Helpers_Arr::exception($e->getPrevious())]); } } else { $data = NULL; } return $data; }