renderable(function (\Symfony\Component\HttpKernel\Exception\NotFoundHttpException $exception, $request) { return response()->json([ 'message' => 'not found'], 404); }); $this->renderable(function (InvalidOtpParameterException $exception, $request) { return response()->json([ 'message' => 'invalid OTP parameters', 'reason' => [$exception->getMessage()] ], 400); }); $this->renderable(function (InvalidQrCodeException $exception, $request) { return response()->json([ 'message' => 'not a valid QR code'], 400); }); $this->renderable(function (InvalidSecretException $exception, $request) { return response()->json([ 'message' => 'not a valid base32 encoded secret'], 400); }); $this->renderable(function (DbEncryptionException $exception, $request) { return response()->json([ 'message' => $exception->getMessage()], 400); }); $this->renderable(function (\Illuminate\Auth\AuthenticationException $exception, $request) { if ($exception->guards() === ['reverse-proxy-guard']) { return response()->json([ 'message' => $exception->getMessage()], 407); } else { return response()->json([ 'message' => $exception->getMessage()], 401); } }); } }