Hello. Look at my code and say me, where i have bad way…
$app = new \Slim\App(['settings'=>['displayErrorDetails' => true]]);
$container = $app->getContainer();
$container['errorHandler'] = function ($c) {
return function ($request, $response, $exception) use ($c) {
return $response->withStatus(500)->withJson([
'result' => false, 'message' => $exception->getMessage()
]);
};
};
$container['testException'] = function ($c) {
throw ner Exception('test');
return [];
}
$app->run();
$app->get('/',function (Request $request, Response $response, array $args) use ($app) {
$exception = $app->getContainer()['testException'];
//Here erroHandler must return me json, but no:( i take 500 status code and exception in my apache2 log.
}
Help me pls solve this problem; Thx for ur time.
p.s. sorry for my bad english.