[api] reward + thanks

This commit is contained in:
xiaomlove
2022-03-30 15:37:11 +08:00
parent b613a46b8d
commit 3e4a5766c4
38 changed files with 983 additions and 64 deletions

View File

@@ -61,7 +61,8 @@ class Handler extends ExceptionHandler
$this->renderable(function (NotFoundHttpException $e) {
if ($e->getPrevious() && $e->getPrevious() instanceof ModelNotFoundException) {
return response()->json(fail('No query result.', request()->all()), 404);
$exception = $e->getPrevious();
return response()->json(fail($exception->getMessage(), request()->all()), 404);
}
});
}
@@ -97,7 +98,12 @@ class Handler extends ExceptionHandler
protected function getHttpStatusCode(Throwable $e)
{
if ($e instanceof \InvalidArgumentException || $e instanceof NexusException) {
if (
$e instanceof NexusException
|| $e instanceof \InvalidArgumentException
|| $e instanceof \LogicException
|| $e instanceof \RuntimeException
) {
return 200;
}
if ($this->isHttpException($e)) {