anchor.diff:          {[{<<"error">>,  ErrorStr},
           {<<"reason">>, ReasonStr}]});
   send_error(Req, Code, Headers, ErrorStr, ReasonStr, Stack) ->
  -    log_stack_trace(Stack),
  +    log_error_with_stack_trace({ErrorStr, ReasonStr, Stack}),
       send_json(Req, Code, [stack_trace_id(Stack) | Headers],
           {[{<<"error">>,  ErrorStr},
  -        {<<"reason">>, ReasonStr},
  -        {<<"ref">>, stack_hash(Stack)}
  +        {<<"reason">>, ReasonStr} |
  +        case Stack of [] -> []; _ -> [{<<"ref">>, stack_hash(Stack)}] end
       ]}).
   
   % give the option for list functions to output html or other raw errors
  
positive.code: 
  send_chunked_error(Resp, Error) ->
      Stack = json_stack(Error),
      log_stack_trace(Stack),
      {Code, ErrorStr, ReasonStr} = error_info(Error),
      JsonError = {[{<<"code">>, Code},
          {<<"error">>,  ErrorStr},
          {<<"reason">>, ReasonStr},
          {<<"ref">>, stack_hash(Stack)}
      ]},
      send_chunk(Resp, ?l2b([$\n,?JSON_ENCODE(JsonError),$\n])),
      send_chunk(Resp, []).
  
negative.code:     {ok, Resp} = send_error(Req, Code, ErrorStr, ReasonStr),
      {ok, DelayedResp#delayed_resp{resp=Resp}};
  send_delayed_error(#delayed_resp{resp=Resp}, Reason) ->
      log_error_with_stack_trace(Reason),
      throw({http_abort, Resp, Reason}).
  
  end_delayed_json_response(#delayed_resp{}=DelayedResp) ->
  