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