fix(bridge_api): fix response status code for some operations
This commit is contained in:
parent
c90ca1ea53
commit
84e78f5d2e
|
@ -387,6 +387,7 @@ schema("/bridges/:id/enable/:enable") ->
|
|||
responses =>
|
||||
#{
|
||||
204 => <<"Success">>,
|
||||
400 => error_schema('BAD_REQUEST', non_compat_bridge_msg()),
|
||||
404 => error_schema('NOT_FOUND', "Bridge not found or invalid operation"),
|
||||
503 => error_schema('SERVICE_UNAVAILABLE', "Service unavailable")
|
||||
}
|
||||
|
@ -667,6 +668,10 @@ get_metrics_from_local_node(BridgeType0, BridgeName) ->
|
|||
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
||||
{error, timeout} ->
|
||||
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
||||
{error, not_bridge_v1_compatible} ->
|
||||
?BAD_REQUEST(non_compat_bridge_msg());
|
||||
{error, bridge_not_found} ->
|
||||
?BRIDGE_NOT_FOUND(BridgeType, BridgeName);
|
||||
{error, Reason} ->
|
||||
?INTERNAL_ERROR(Reason)
|
||||
end
|
||||
|
|
|
@ -394,7 +394,7 @@ schema("/bridges_v2_probe") ->
|
|||
case emqx_bridge_v2:disable_enable(enable_func(Enable), BridgeType, BridgeName) of
|
||||
{ok, _} ->
|
||||
?NO_CONTENT;
|
||||
{error, {pre_config_update, _, not_found}} ->
|
||||
{error, {pre_config_update, _, bridge_not_found}} ->
|
||||
?BRIDGE_NOT_FOUND(BridgeType, BridgeName);
|
||||
{error, {_, _, timeout}} ->
|
||||
?SERVICE_UNAVAILABLE(<<"request timeout">>);
|
||||
|
|
Loading…
Reference in New Issue