Created content based error handler which allows managing errors in a different way depending on the Accepted content type from the client

This commit is contained in:
Alejandro Celaya
2016-07-27 20:17:23 +02:00
parent f3d2cf5e15
commit 75e744838c
12 changed files with 219 additions and 11 deletions

View File

@@ -1,14 +1,14 @@
<?php
use Shlinkio\Shlink\Common\Expressive\ContentBasedErrorHandler;
use Zend\Expressive\Container\WhoopsErrorHandlerFactory;
return [
'services' => [
'invokables' => [
'Zend\Expressive\Whoops' => Whoops\Run::class,
'Zend\Expressive\WhoopsPageHandler' => Whoops\Handler\PrettyPageHandler::class,
],
'factories' => [
'Zend\Expressive\FinalHandler' => Zend\Expressive\Container\WhoopsErrorHandlerFactory::class,
],
],
'whoops' => [
@@ -18,4 +18,12 @@ return [
'ajax_only' => true,
],
],
'error_handler' => [
'plugins' => [
'factories' => [
ContentBasedErrorHandler::DEFAULT_CONTENT => WhoopsErrorHandlerFactory::class,
],
],
],
];