2020-02-04 22:55:25 +01:00

32 lines
898 B
PHP

<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Foundation\ErrorHandling;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
interface HttpFormatter
{
/**
* Create an HTTP Response to represent the error we are handling.
*
* This method receives the error that was caught by Flarum's error handling
* stack, along with the current HTTP request instance. It should return an
* HTTP response that explains or represents what went wrong.
*
* @param HandledError $error
* @param Request $request
* @return Response
*/
public function format(HandledError $error, Request $request): Response;
}