fix(auth_pgsql): Add back econnrefused error clause
This commit is contained in:
parent
fc71285c3f
commit
f42e52e84e
|
@ -56,6 +56,11 @@ pgvar(Sql, Params) ->
|
||||||
%% PostgreSQL Connect/Query
|
%% PostgreSQL Connect/Query
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
%% Due to a bug in epgsql the caluse for `econnrefused` is not recognised by
|
||||||
|
%% dialyzer, result in this error:
|
||||||
|
%% The pattern {'error', Reason = 'econnrefused'} can never match the type ...
|
||||||
|
%% https://github.com/epgsql/epgsql/issues/246
|
||||||
|
-dialyzer([{nowarn_function, [connect/1]}]).
|
||||||
connect(Opts) ->
|
connect(Opts) ->
|
||||||
Host = proplists:get_value(host, Opts),
|
Host = proplists:get_value(host, Opts),
|
||||||
Username = proplists:get_value(username, Opts),
|
Username = proplists:get_value(username, Opts),
|
||||||
|
@ -64,6 +69,9 @@ connect(Opts) ->
|
||||||
{ok, C} ->
|
{ok, C} ->
|
||||||
conn_post(C),
|
conn_post(C),
|
||||||
{ok, C};
|
{ok, C};
|
||||||
|
{error, Reason = econnrefused} ->
|
||||||
|
?LOG(error, "[Postgres] Can't connect to Postgres server: Connection refused."),
|
||||||
|
{error, Reason};
|
||||||
{error, Reason = invalid_authorization_specification} ->
|
{error, Reason = invalid_authorization_specification} ->
|
||||||
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid authorization specification."),
|
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid authorization specification."),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
|
|
Loading…
Reference in New Issue