Skip to content

Commit

Permalink
removing catching timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
lattenwald committed Oct 11, 2018
1 parent 138acba commit 96f8611
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/tdlib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,16 @@ send_sync(Pid, Request) ->
%%====================================================================
%% @doc Send tdlib request and block until response is received.
%%
%% Inside it's a <code>gen_server:call</code>, so expect
%% <code>{timeout, _}</code> error if you need to handle this.
%%
%% @param Pid tdlib gen_server pid
%% @param Request list of pairs to be JSON-encoded.
%% @param Timeout timeout
%% @returns decoded response or <code>{error, timeout}</code>
%% @returns decoded response
%%====================================================================
send_sync(Pid, Request, Timeout) ->
try
gen_server:call(Pid, {send_sync, Request, Timeout}, Timeout)
catch
_:{timeout, _} -> {error, timeout}
end.

gen_server:call(Pid, {send_sync, Request, Timeout}, Timeout).

%%====================================================================
%% @doc Execute synchronous tdlib request.
Expand Down

0 comments on commit 96f8611

Please sign in to comment.