Merge pull request #11175 from thalesmg/fix-mysql-start-error
fix(mysql_bridge): make nxdomain a 400 API error
This commit is contained in:
commit
353cc065db
|
@ -985,9 +985,13 @@ call_operation(NodeOrAll, OperFunc, Args = [_Nodes, BridgeType, BridgeName]) ->
|
||||||
{error, timeout} ->
|
{error, timeout} ->
|
||||||
?SERVICE_UNAVAILABLE(<<"Request timeout">>);
|
?SERVICE_UNAVAILABLE(<<"Request timeout">>);
|
||||||
{error, {start_pool_failed, Name, Reason}} ->
|
{error, {start_pool_failed, Name, Reason}} ->
|
||||||
?SERVICE_UNAVAILABLE(
|
Msg = bin(io_lib:format("Failed to start ~p pool for reason ~p", [Name, Reason])),
|
||||||
bin(io_lib:format("Failed to start ~p pool for reason ~p", [Name, Reason]))
|
case Reason of
|
||||||
);
|
nxdomain ->
|
||||||
|
?BAD_REQUEST(Msg);
|
||||||
|
_ ->
|
||||||
|
?SERVICE_UNAVAILABLE(Msg)
|
||||||
|
end;
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
BridgeId = emqx_bridge_resource:bridge_id(BridgeType, BridgeName),
|
BridgeId = emqx_bridge_resource:bridge_id(BridgeType, BridgeName),
|
||||||
?SLOG(warning, #{
|
?SLOG(warning, #{
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{erl_opts, [debug_info]}.
|
{erl_opts, [debug_info]}.
|
||||||
{deps, [
|
{deps, [
|
||||||
%% NOTE: mind ecpool version when updating eredis_cluster version
|
%% NOTE: mind ecpool version when updating eredis_cluster version
|
||||||
{mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.2"}}},
|
{mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.3"}}},
|
||||||
{emqx_connector, {path, "../../apps/emqx_connector"}},
|
{emqx_connector, {path, "../../apps/emqx_connector"}},
|
||||||
{emqx_resource, {path, "../../apps/emqx_resource"}}
|
{emqx_resource, {path, "../../apps/emqx_resource"}}
|
||||||
]}.
|
]}.
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Now when using a nonexistent hostname for connecting to MySQL will result in a 400 error rather than 503 in the HTTP API.
|
Loading…
Reference in New Issue