瀏覽代碼

Add a new Exception to be gracefully rendered

Bubka 3 年之前
父節點
當前提交
350d00902e
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      app/Exceptions/Handler.php

+ 4 - 0
app/Exceptions/Handler.php

@@ -53,6 +53,10 @@ class Handler extends ExceptionHandler
             return response()->json([
                 'message' => str_replace('App\\', '', $exception->getModel()).' not found'], 404);
         }
+        if ($exception instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
+            return response()->json([
+                'message' => 'not found'], 404);
+        }
         if ($exception instanceof InvalidOtpParameterException) {
             return response()->json([
                 'message' => 'invalid OTP parameters',