Hi all,
I tried to upload a file to a location that didn’t exist and my app died. I want to handle a situation like this so that a nice JSON error message is returned explaining what went wrong.
I created an HttpExceptionMiddleware
class and included my Responder:
use App\Responder\Responder;
In the process
method I tried returning the responder like so:
return $this->responder->withJson($response, $responseData);
In config/middleware
:
$app->add(HttpExceptionMiddleware::class);
In my container:
// For the responder
ResponseFactoryInterface::class => function (ContainerInterface $container) {
return $container->get(App::class)->getResponseFactory();
},
What am I doing wrong?
Thank you
FBS