Cachet/app/Exceptions/Handler.php
2015-06-12 23:27:30 +01:00

48 lines
1.1 KiB
PHP

<?php
/*
* This file is part of Cachet.
*
* (c) Cachet HQ <support@cachethq.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Exceptions;
use Exception;
use GrahamCampbell\Exceptions\ExceptionHandler;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Response;
use Symfony\Component\HttpKernel\Exception\HttpNotFoundException;
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var string[]
*/
protected $dontReport = [
HttpNotFoundException::class,
];
/**
* 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 ($e instanceof ModelNotFoundException) {
$e = new HttpNotFoundException('Resource not found');
}
return parent::render($request, $e);
}
}