Permalink
Browse files

Report Transport:connect errors from client:connect.

  • Loading branch information...
1 parent 0c2e222 commit 01ae16f84e1566221d01e6b29595fdf9efc9445d @archaelus archaelus committed Jun 8, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/cowboy_client.erl
@@ -62,8 +62,13 @@ connect(Transport, Host, Port, Client=#client{state=State, opts=Opts})
when is_atom(Transport), is_list(Host),
is_integer(Port), is_record(Client, client),
State =:= wait ->
- {ok, Socket} = Transport:connect(Host, Port, Opts),
- {ok, Client#client{state=request, socket=Socket, transport=Transport}}.
+ case Transport:connect(Host, Port, Opts) of
+ {ok, Socket} ->
+ {ok, Client#client{state=request,
+ socket=Socket,
+ transport=Transport}};
+ {error, _} = Err -> Err
+ end.
raw_request(Data, Client=#client{state=response_body}) ->
{done, Client2} = skip_body(Client),

0 comments on commit 01ae16f

Please sign in to comment.