public function __invoke(Request $request, Response $response, \Exception $exception)
 {
     // Log the message
     $this->logger->critical($exception->getMessage());
     // create a JSON error string for the Response body
     $body = json_encode(['error' => $exception->getMessage(), 'code' => $exception->getCode()], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     return $response->withStatus(500)->withHeader('Content-type', 'application/json')->write($body);
 }
 public function __invoke(Request $request, Response $response, \Exception $exception)
 {
     // Log the message
     $this->logger->critical($exception->getMessage());
     return parent::__invoke($request, $response, $exception);
 }