1111use Illuminate \Database \Eloquent \ModelNotFoundException ;
1212use Pterodactyl \Exceptions \Model \DataValidationException ;
1313use Symfony \Component \HttpKernel \Exception \HttpException ;
14+ use Pterodactyl \Exceptions \Repository \RecordNotFoundException ;
1415use Illuminate \Foundation \Exceptions \Handler as ExceptionHandler ;
1516
1617class Handler extends ExceptionHandler
@@ -28,6 +29,7 @@ class Handler extends ExceptionHandler
2829 DisplayValidationException::class,
2930 HttpException::class,
3031 ModelNotFoundException::class,
32+ RecordNotFoundException::class,
3133 TokenMismatchException::class,
3234 ValidationException::class,
3335 ];
@@ -69,7 +71,7 @@ public function render($request, Exception $exception)
6971 $ response = response ()->json (
7072 [
7173 'error ' => $ displayError ,
72- 'http_code ' => (! $ this -> isHttpException ($ exception )) ?: $ exception ->getStatusCode (),
74+ 'http_code ' => (method_exists ($ exception, ' getStatusCode ' )) ? $ exception ->getStatusCode () : 500 ,
7375 'trace ' => (! config ('app.debug ' )) ? null : $ exception ->getTrace (),
7476 ],
7577 $ this ->isHttpException ($ exception ) ? $ exception ->getStatusCode () : 500 ,
0 commit comments