fix(bridge): mysql bridge error case
This commit is contained in:
parent
54a9c8d201
commit
0390a5e547
|
@ -532,6 +532,17 @@ lookup_from_local_node(BridgeType, BridgeName) ->
|
||||||
{200};
|
{200};
|
||||||
{error, timeout} ->
|
{error, timeout} ->
|
||||||
{503, error_msg('SERVICE_UNAVAILABLE', <<"request timeout">>)};
|
{503, error_msg('SERVICE_UNAVAILABLE', <<"request timeout">>)};
|
||||||
|
{error, {start_pool_failed, Name, Reason}} ->
|
||||||
|
{503,
|
||||||
|
error_msg(
|
||||||
|
'SERVICE_UNAVAILABLE',
|
||||||
|
bin(
|
||||||
|
io_lib:format(
|
||||||
|
"failed to start ~p pool for reason ~p",
|
||||||
|
[Name, Reason]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
{500, error_msg('INTERNAL_ERROR', Reason)}
|
{500, error_msg('INTERNAL_ERROR', Reason)}
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,12 +40,13 @@ start_pool(Name, Mod, Options) ->
|
||||||
stop_pool(Name),
|
stop_pool(Name),
|
||||||
start_pool(Name, Mod, Options);
|
start_pool(Name, Mod, Options);
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
|
NReason = parse_reason(Reason),
|
||||||
?SLOG(error, #{
|
?SLOG(error, #{
|
||||||
msg => "start_ecpool_error",
|
msg => "start_ecpool_error",
|
||||||
pool_name => Name,
|
pool_name => Name,
|
||||||
reason => Reason
|
reason => NReason
|
||||||
}),
|
}),
|
||||||
{error, {start_pool_failed, Name, Reason}}
|
{error, {start_pool_failed, Name, NReason}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
stop_pool(Name) ->
|
stop_pool(Name) ->
|
||||||
|
@ -86,3 +87,11 @@ health_check_ecpool_workers(PoolName, CheckFunc, Timeout) when is_function(Check
|
||||||
exit:timeout ->
|
exit:timeout ->
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
parse_reason({
|
||||||
|
{shutdown, {failed_to_start_child, _, {shutdown, {failed_to_start_child, _, Reason}}}},
|
||||||
|
_
|
||||||
|
}) ->
|
||||||
|
Reason;
|
||||||
|
parse_reason(Reason) ->
|
||||||
|
Reason.
|
||||||
|
|
Loading…
Reference in New Issue