123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /*
- * This file is part of the Jiannei/lumen-api-starter.
- *
- * (c) Jiannei <longjian.huang@foxmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
- namespace App\Exceptions;
- use Exception;
- use Illuminate\Auth\Access\AuthorizationException;
- use Illuminate\Database\Eloquent\ModelNotFoundException;
- use Illuminate\Http\Exceptions\HttpResponseException;
- use Illuminate\Http\JsonResponse;
- use Illuminate\Http\Request;
- use Illuminate\Http\Response;
- use Illuminate\Validation\ValidationException;
- use Jiannei\Response\Laravel\Support\Traits\ExceptionTrait;
- use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
- use Symfony\Component\HttpKernel\Exception\HttpException;
- use Throwable;
- class Handler extends ExceptionHandler
- {
- use ExceptionTrait;
- /**
- * A list of the exception types that should not be reported.
- *
- * @var array
- */
- protected $dontReport = [
- AuthorizationException::class,
- HttpException::class,
- ModelNotFoundException::class,
- ValidationException::class,
- HttpResponseException::class,
- ];
- /**
- * Report or log an exception.
- *
- * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
- *
- * @param Throwable $exception
- *
- * @throws Exception
- */
- public function report(Throwable $exception)
- {
- parent::report($exception);
- }
- /**
- * Render an exception into an HTTP response.
- *
- * @param Request $request
- * @param Throwable $exception
- *
- * @return Response|JsonResponse
- *
- * @throws Throwable
- */
- public function render($request, Throwable $exception)
- {
- return parent::render($request, $exception);
- }
- }
|