Replace case catch ... with try catch
This commit is contained in:
parent
65eba08912
commit
80cbf6cbb1
|
@ -112,10 +112,13 @@ handle_info({'EXIT', Pid, Reason}, State = #state{client = Pid, opts = Opts}) ->
|
||||||
end;
|
end;
|
||||||
|
|
||||||
handle_info(reconnect, State = #state{opts = Opts}) ->
|
handle_info(reconnect, State = #state{opts = Opts}) ->
|
||||||
case catch connect(State) of
|
try connect(State) of
|
||||||
{ok, Client} ->
|
{ok, Client} ->
|
||||||
{noreply, State#state{client = Client}};
|
{noreply, State#state{client = Client}};
|
||||||
{Err, _Reason} when Err =:= error orelse Err =:= 'EXIT' ->
|
{error, _Reason} ->
|
||||||
|
reconnect(proplists:get_value(auto_reconnect, Opts), State)
|
||||||
|
catch
|
||||||
|
_Error:_Reason ->
|
||||||
reconnect(proplists:get_value(auto_reconnect, Opts), State)
|
reconnect(proplists:get_value(auto_reconnect, Opts), State)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue