protected function setErrorHandler(Container $container): callable
    {
        return function (Container $container) {
            return function (ServerRequestInterface $request, ResponseInterface $response, Throwable $e) use ($container) {
                $container->sentry->captureException($e);
                if ($container->has('appErrorHandler')) {
                    return $container['appErrorHandler']->error500($request, $response, $e);
                }

                return $response->withStatus(500);
            };
        };
    }
protected function setErrorHandler(Container $container): callable
    {
        return function (Container $container) {
            return function (ServerRequestInterface $request, ResponseInterface $response, Throwable $e) use ($container) {
                $container->sentry->captureException($e);
                if ($container->has('appErrorHandler')) {
                    return $container['appErrorHandler']->error500($request, $response, $e);
                }

                return $response->withStatus(500);
            };
        };
    }
protected function setErrorHandler ( Container $ container ) : callable { return function ( Container $ container ) { return function ( ServerRequestInterface $ request , ResponseInterface $ response , Throwable $ e ) use ( $ container ) { $ container -> sentry -> captureException ( $ e ) ; if ( $ container -> has ( 'appErrorHandler' ) ) { return $ container [ 'appErrorHandler' ] -> error500 ( $ request , $ response , $ e ) ; } return $ response -> withStatus ( 500 ) ; } ; } ; }
Set error handler with sentry.

@param Container $container

@return callable
Set error handler with sentry .