
Change-Id: If50215221a6e6a6add1970022a279896b2d1cff0 Signed-off-by: smarcet <smarcet@gmail.com>
68 lines
2.0 KiB
PHP
68 lines
2.0 KiB
PHP
<?php namespace App\Exceptions;
|
|
/**
|
|
* Copyright 2015 OpenStack Foundation
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
**/
|
|
use Exception;
|
|
use Illuminate\Validation\ValidationException;
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
use Predis\Connection\ConnectionException as RedisConnectionException;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
|
/**
|
|
* Class Handler
|
|
* @package App\Exceptions
|
|
*/
|
|
class Handler extends ExceptionHandler
|
|
{
|
|
/**
|
|
* A list of the exception types that should not be reported.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $dontReport = [
|
|
AuthorizationException::class,
|
|
HttpException::class,
|
|
ModelNotFoundException::class,
|
|
ValidationException::class,
|
|
RedisConnectionException::class,
|
|
];
|
|
|
|
/**
|
|
* Report or log an exception.
|
|
*
|
|
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
|
|
*
|
|
* @param \Exception $e
|
|
* @return void
|
|
*/
|
|
public function report(Exception $e)
|
|
{
|
|
parent::report($e);
|
|
}
|
|
|
|
/**
|
|
* Render an exception into an HTTP response.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Exception $e
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function render($request, Exception $e)
|
|
{
|
|
if (config('app.debug')) {
|
|
return parent::render($request, $e);
|
|
}
|
|
return response()->view('errors.404', [], 200);
|
|
}
|
|
}
|