From a0ef02e4f6aa54184e8e9a76fed20b553a11a89e Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 20 Jun 2015 20:39:29 +0200 Subject: [PATCH] Use Whoops in debug mode, JSON API compliant errors otherwise --- api.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api.php b/api.php index b29f12f..d18a5a8 100644 --- a/api.php +++ b/api.php @@ -1,5 +1,6 @@ pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters')); $api->pipe($app->make('Flarum\Api\Middleware\LoginWithHeader')); $api->pipe('/api', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')])); -$api->pipe(new \Flarum\Api\Middleware\JsonApiErrors()); + +if (Core::inDebugMode()) { + $api->pipe(new \Franzl\Middleware\Whoops\Middleware()); +} else { + $api->pipe(new \Flarum\Api\Middleware\JsonApiErrors()); +} $server = Server::createServer( $api,