anchor.diff:    gen_tcp:close(Conn),
     {ok, Req, [{result, ok}|Env]}.
   
  --spec error_terminate(cowboy_req:req(), #state{}) -> no_return().
  -error_terminate(Req, State) ->
  +error_terminate(Req, State=#state{handler=Handler, handler_state=HandlerState},
  +		Class, Reason, Callback, Arity) ->
     proxy_terminate(Req, State),
  -  erlang:raise(throw, {?MODULE, error}, erlang:get_stacktrace()).
  +  cowboy_req:maybe_reply(500, Req),
  +  erlang:Class([
  +    {reason, Reason},
  +    {mfa, {Handler, Callback, Arity}},
  +    {stacktrace, erlang:get_stacktrace()},
  +    {req, cowboy_req:to_list(Req)},
  +    {state, HandlerState}
  +  ]).
   
   proxy_terminate(Req, #state{handler=Handler, handler_state=HandlerState}) ->
     case erlang:function_exported(Handler, proxy_terminate, 2) of
  
positive.code:       try
          Handler:Callback(Req, HandlerState)
        catch Class:Reason ->
          error_logger:error_msg(
            "** Cowboy handler ~p terminating in ~p/~p~n"
            "   for the reason ~p:~p~n** Handler state was ~p~n"
            "** Request was ~p~n** Stacktrace: ~p~n~n",
            [Handler, Callback, 2, Class, Reason, HandlerState,
              cowboy_req:to_list(Req), erlang:get_stacktrace()]),
          error_terminate(Req, State)
        end;
      false ->
        no_call
  
negative.code: 
  next(Req, State, Next) when is_function(Next) ->
    Next(Req, State);
  next(Req, State, StatusCode) when is_integer(StatusCode) ->
    respond(Req, State, StatusCode).
  
  