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

Use new error handler middleware

This commit is contained in:
Franz Liedke
2019-08-09 20:47:37 +02:00
parent cfbaa84fbc
commit 57ce25301d
4 changed files with 35 additions and 34 deletions

View File

@@ -16,6 +16,10 @@ use Flarum\Extension\Event\Disabled;
use Flarum\Extension\Event\Enabled;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use Flarum\Foundation\ErrorHandling\Registry;
use Flarum\Foundation\ErrorHandling\Reporter;
use Flarum\Foundation\ErrorHandling\ViewRenderer;
use Flarum\Foundation\ErrorHandling\WhoopsRenderer;
use Flarum\Foundation\Event\ClearingCache;
use Flarum\Frontend\AddLocaleAssets;
use Flarum\Frontend\AddTranslations;
@@ -51,11 +55,11 @@ class AdminServiceProvider extends AbstractServiceProvider
$pipe = new MiddlewarePipe;
// All requests should first be piped through our global error handler
if ($app->inDebugMode()) {
$pipe->pipe($app->make(HttpMiddleware\HandleErrorsWithWhoops::class));
} else {
$pipe->pipe($app->make(HttpMiddleware\HandleErrorsWithView::class));
}
$pipe->pipe(new HttpMiddleware\HandleErrors(
$app->make(Registry::class),
$app->inDebugMode() ? $app->make(WhoopsRenderer::class) : $app->make(ViewRenderer::class),
$app->make(Reporter::class)
));
$pipe->pipe($app->make(HttpMiddleware\ParseJsonBody::class));
$pipe->pipe($app->make(HttpMiddleware\StartSession::class));