Use the HttpExceptionInterface rather than a render function here

This commit is contained in:
Dane Everitt 2019-03-03 13:57:18 -08:00
parent f15449f17b
commit 3411df784a
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -2,19 +2,28 @@
namespace Pterodactyl\Exceptions\Repository;
class RecordNotFoundException extends RepositoryException
use Illuminate\Http\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class RecordNotFoundException extends RepositoryException implements HttpExceptionInterface
{
/**
* Handle request to render this exception to a user. Returns the default
* 404 page view.
* Returns the status code.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return int
*/
public function render($request)
public function getStatusCode()
{
if (! config('app.debug')) {
return response()->view('errors.404', [], 404);
}
return Response::HTTP_NOT_FOUND;
}
/**
* Returns response headers.
*
* @return array
*/
public function getHeaders()
{
return [];
}
}