]> BookStack Code Mirror - bookstack/blob - app/Exceptions/Handler.php
Added social sign in
[bookstack] / app / Exceptions / Handler.php
1 <?php
2
3 namespace Oxbow\Exceptions;
4
5 use Exception;
6 use Symfony\Component\HttpKernel\Exception\HttpException;
7 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8
9 class Handler extends ExceptionHandler
10 {
11     /**
12      * A list of the exception types that should not be reported.
13      *
14      * @var array
15      */
16     protected $dontReport = [
17         HttpException::class,
18     ];
19
20     /**
21      * Report or log an exception.
22      *
23      * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
24      *
25      * @param  \Exception $e
26      */
27     public function report(Exception $e)
28     {
29         return parent::report($e);
30     }
31
32     /**
33      * Render an exception into an HTTP response.
34      *
35      * @param  \Illuminate\Http\Request  $request
36      * @param  \Exception  $e
37      * @return \Illuminate\Http\Response
38      */
39     public function render($request, Exception $e)
40     {
41         if($e instanceof NotifyException) {
42             \Session::flash('error', $e->message);
43             return response()->redirectTo($e->redirectLocation);
44         }
45
46         return parent::render($request, $e);
47     }
48 }