Commits

jus...@basho.com  committed 1f62ab1 Merge

merge

  • Participants
  • Parent commits 6539dbd, cb1b6be

Comments (0)

Files changed (1)

File src/webmachine_resource.erl

     end.
 
 do(Fun, ReqProps) when is_atom(Fun) andalso is_list(ReqProps) ->
-    Self = proplists:get_value(resource, ReqProps),
     RState0 = proplists:get_value(reqstate, ReqProps),
     put(tmp_reqstate, empty),
     {Reply, ReqData, NewModState} = handle_wm_call(Fun, 
                     (RState0#reqstate.reqdata)#wm_reqdata{wm_state=RState0}),
-    case Reply of
-        {error, Err} -> {Err, Self};
-        _ ->
-            ReqState = case get(tmp_reqstate) of
-                empty -> RState0;
-                X -> X
-            end,
-            {Reply,
-            webmachine_resource:new(R_Mod, NewModState, R_ModExports, R_Trace),
-            ReqState#reqstate{reqdata=ReqData}}
-    end.
+    ReqState = case get(tmp_reqstate) of
+                   empty -> RState0;
+                   X -> X
+               end,
+    {Reply,
+     webmachine_resource:new(R_Mod, NewModState, R_ModExports, R_Trace),
+     ReqState#reqstate{reqdata=ReqData}}.
 
 handle_wm_call(Fun, ReqData) ->
     case default(Fun) of
     {'WMTRACE_ESCAPED_PORT', erlang:port_to_list(Port)};
 escape_trace_data(List) when is_list(List) ->
     escape_trace_list(List, []);
+escape_trace_data(R=#reqstate{}) ->
+    list_to_tuple(
+      escape_trace_data(
+        tuple_to_list(R#reqstate{reqdata='WMTRACE_NESTED_REQDATA'})));
 escape_trace_data(Tuple) when is_tuple(Tuple) ->
     list_to_tuple(escape_trace_data(tuple_to_list(Tuple)));
 escape_trace_data(Other) ->