You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuHandler.php 573B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace Luticate\Utils;
  3. use Exception;
  4. use Symfony\Component\HttpKernel\Exception\HttpException;
  5. use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
  6. class LuHandler extends ExceptionHandler {
  7. public function render($request, Exception $e)
  8. {
  9. LuLog::log($e);
  10. $data = "Internal error";
  11. $code = 500;
  12. if ($e instanceof HttpException)
  13. {
  14. $data = $e->getMessage();
  15. $code = $e->getStatusCode();
  16. }
  17. return response(LuOutputFormatter::formatError($code, $data), $code);
  18. }
  19. }