Browse Source

Handler.php add http status code in comment

Yong 2 years ago
parent
commit
3a47ea90cf
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      app/Exceptions/Handler.php

+ 5
- 5
app/Exceptions/Handler.php View File

@@ -57,23 +57,23 @@ class Handler extends ExceptionHandler
57 57
 
58 58
     public function handleApiException(Throwable $exception)
59 59
     {
60
-        // Route Not Found
60
+        // Route Not Found 404
61 61
         if ($exception instanceof RouteNotFoundException) {
62 62
             return $this->apiExceptionResponse($exception, Response::HTTP_NOT_FOUND, config('response-message.router_failed'));
63 63
         }
64 64
 
65
-        // Not Found
65
+        // Not Found 404
66 66
         if ($exception instanceof NotFoundHttpException) {
67 67
             $message = $exception->getMessage() ?: config('response-message.not_found');
68 68
             return $this->apiExceptionResponse($exception, Response::HTTP_NOT_FOUND, $message);
69 69
         }
70 70
 
71
-        // Model Not Found
71
+        // Model Not Found 500
72 72
         if ($exception instanceof ModelNotFoundException) {
73 73
             $exception = new NotFoundHttpException($exception->getMessage(), $exception);
74 74
         }
75 75
 
76
-        // Authentication
76
+        // Authentication 401
77 77
         if ($exception instanceof AuthenticationException) {
78 78
             return $this->apiExceptionResponse($exception, Response::HTTP_UNAUTHORIZED, config('response-message.authenticate_failed'));
79 79
         }
@@ -88,7 +88,7 @@ class Handler extends ExceptionHandler
88 88
             return $this->apiExceptionResponse($exception, $exception->getStatusCode(), $exception->getMessage());
89 89
         }
90 90
 
91
-        // Query
91
+        // Query 500
92 92
         if ($exception instanceof QueryException) {
93 93
             $this->apiExceptionResponse($exception, Response::HTTP_INTERNAL_SERVER_ERROR, config('response-message.sql_error'));
94 94
         }