Skip to content

Instantly share code, notes, and snippets.

@JamesTheHacker
Created September 26, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamesTheHacker/fe00c5e7c86aa1e64572b3052caf19f1 to your computer and use it in GitHub Desktop.
Save JamesTheHacker/fe00c5e7c86aa1e64572b3052caf19f1 to your computer and use it in GitHub Desktop.
$container['errorHandler'] = function ($c) {
return function ($request, $response, $exception) use ($c) {
$c->logger->error('Application Error:', [$exception]);
return $c['response']
->withStatus(500)
->withHeader('Content-Type', 'application/json')
->withJson([
'success' => false,
'error' => "Nope, that didn't work. Try again."
]);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment