Commits

Oscar Hellström committed 8d662d8

Make the requesting process exit instead of the client process

  • Participants
  • Parent commits 687e344

Comments (0)

Files changed (2)

File src/lhttpc.erl

     receive
         {response, Pid, R} ->
             R;
+        {exit, Reason} ->
+            % We would rather want to exit here, since that
+            % could be caught
+            exit(Reason);
         {'EXIT', Pid, Reason} ->
             % This could happen if the process we're running in taps exits
-            erlang:error(Reason)
+            % and the client process exits due to some exit signal being
+            % sent to it. Very unlikely though
+            exit(Reason)
     after Timeout ->
             kill_client(Pid)
     end.

File src/lhttpc_client.erl

 %%    Body = iolist()
 request(From, URL, Method, Hdrs, Body) ->
     case catch execute(From, URL, Method, Hdrs, Body) of
-        {'EXIT', Reason} -> exit(Reason);
+        {'EXIT', Reason} -> From ! {exit, Reason};
         _                -> ok
     end.