1
0
mirror of https://github.com/flarum/core.git synced 2025-10-18 18:26:07 +02:00

Remove old error handler, middleware and tests

This commit is contained in:
Franz Liedke
2019-08-09 20:49:09 +02:00
parent 81a8736ba9
commit 9f71e2c3cb
25 changed files with 0 additions and 1281 deletions

View File

@@ -1,47 +0,0 @@
<?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\Api\Middleware;
use Flarum\Api\ErrorHandler;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\MiddlewareInterface as Middleware;
use Psr\Http\Server\RequestHandlerInterface as Handler;
use Throwable;
class HandleErrors implements Middleware
{
/**
* @var ErrorHandler
*/
protected $errorHandler;
/**
* @param ErrorHandler $errorHandler
*/
public function __construct(ErrorHandler $errorHandler)
{
$this->errorHandler = $errorHandler;
}
/**
* Catch all errors that happen during further middleware execution.
*/
public function process(Request $request, Handler $handler): Response
{
try {
return $handler->handle($request);
} catch (Throwable $e) {
return $this->errorHandler->handle($e);
}
}
}