Skip to content

Commit

Permalink
Correcting spec for eredis:q and eredis:qp
Browse files Browse the repository at this point in the history
A gen_tcp:send / ssl:send can return errors like
  {'error','enotconn'}
  {'error', {'tls_alert', {'certificate_expired', _}}}
which propagates to the user.
  • Loading branch information
bjosv committed Mar 3, 2024
1 parent d46b179 commit fc08c4f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/eredis.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ stop(Client) ->
eredis_client:stop(Client).

-spec q(Client::client(), Command::[any()]) ->
{ok, return_value()} | {error, Reason::binary() | no_connection}.
{ok, return_value()} | {error, Reason::any() | no_connection}.
%% @doc: Executes the given command in the specified connection. The
%% command must be a valid Redis command and may contain arbitrary
%% data which will be converted to binaries. The returned values will
Expand All @@ -151,15 +151,14 @@ q(Client, Command) ->
call(Client, Command, ?TIMEOUT).

-spec q(Client::client(), Command::[any()], Timeout::timeout()) ->
{ok, return_value()} | {error, Reason::binary() | no_connection}.
{ok, return_value()} | {error, Reason::any() | no_connection}.
%% @doc Like q/2 with a custom timeout.
q(Client, Command, Timeout) ->
call(Client, Command, Timeout).


-spec qp(Client::client(), Pipeline::pipeline()) ->
[{ok, return_value()} | {error, Reason::binary()}] |
{error, no_connection}.
[{ok, return_value()} | {error, Reason::any() | no_connection}].
%% @doc: Executes the given pipeline (list of commands) in the
%% specified connection. The commands must be valid Redis commands and
%% may contain arbitrary data which will be converted to binaries. The
Expand All @@ -168,8 +167,7 @@ qp(Client, Pipeline) ->
pipeline(Client, Pipeline, ?TIMEOUT).

-spec qp(Client::client(), Pipeline::pipeline(), Timeout::timeout()) ->
[{ok, return_value()} | {error, Reason::binary()}] |
{error, no_connection}.
[{ok, return_value()} | {error, Reason::any() | no_connection}].
%% @doc Like qp/2 with a custom timeout.
qp(Client, Pipeline, Timeout) ->
pipeline(Client, Pipeline, Timeout).
Expand Down

0 comments on commit fc08c4f

Please sign in to comment.