mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Expanded API code, wrote a bunch new transformers as well.
This commit is contained in:
@@ -64,7 +64,23 @@ class Handler extends ExceptionHandler
|
||||
public function render($request, Exception $exception)
|
||||
{
|
||||
if ($exception instanceof NotFoundHttpException && $request->expectsJson()) {
|
||||
return response()->json(['message' => 'Not found'], 404);
|
||||
return response()->json(['message' => 'Resource not found', 'exception' => 'NotFoundHttpException'], 404);
|
||||
}
|
||||
if ($request->expectsJson()) {
|
||||
$isDebug = env('APP_DEBUG', false);
|
||||
if ($isDebug) {
|
||||
return response()->json(
|
||||
[
|
||||
'message' => $exception->getMessage(),
|
||||
'exception' => get_class($exception),
|
||||
'line' => $exception->getLine(),
|
||||
'file' => $exception->getFile(),
|
||||
'trace' => $exception->getTrace(),
|
||||
], 500
|
||||
);
|
||||
}
|
||||
|
||||
return response()->json(['message' => 'Internal Firefly III Exception. See log files.', 'exception' => get_class($exception)], 500);
|
||||
}
|
||||
|
||||
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
|
||||
|
Reference in New Issue
Block a user