public function process(
        RequestInterface $request,
        ResponseInterface $response,
        DelegateInterface $next = null
    ) {
        try {
            if ($next) {
                return $next->next($request, $response);
            }
            return $response;
        } catch (\Exception $e) {
            return WhoopsRunner::handle($e, $request);
        }
    }