Merge pull request #11268 from thalesmg/fix-unhealthy-target-api-return
fix(resource): don't destruct error tuple
This commit is contained in:
commit
faa851d51a
|
@ -546,7 +546,12 @@ schema("/bridges_probe") ->
|
||||||
?NO_CONTENT;
|
?NO_CONTENT;
|
||||||
{error, #{kind := validation_error} = Reason} ->
|
{error, #{kind := validation_error} = Reason} ->
|
||||||
?BAD_REQUEST('TEST_FAILED', map_to_json(Reason));
|
?BAD_REQUEST('TEST_FAILED', map_to_json(Reason));
|
||||||
{error, Reason} when not is_tuple(Reason); element(1, Reason) =/= 'exit' ->
|
{error, Reason0} when not is_tuple(Reason0); element(1, Reason0) =/= 'exit' ->
|
||||||
|
Reason =
|
||||||
|
case Reason0 of
|
||||||
|
{unhealthy_target, Message} -> Message;
|
||||||
|
_ -> Reason0
|
||||||
|
end,
|
||||||
?BAD_REQUEST('TEST_FAILED', Reason)
|
?BAD_REQUEST('TEST_FAILED', Reason)
|
||||||
end;
|
end;
|
||||||
BadRequest ->
|
BadRequest ->
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ t_nonexistent_topic(Config) ->
|
||||||
emqx_resource_manager:health_check(ResourceId)
|
emqx_resource_manager:health_check(ResourceId)
|
||||||
),
|
),
|
||||||
?assertMatch(
|
?assertMatch(
|
||||||
{ok, _Group, #{error := "GCP PubSub topics are invalid" ++ _}},
|
{ok, _Group, #{error := {unhealthy_target, "GCP PubSub topics are invalid" ++ _}}},
|
||||||
emqx_resource_manager:lookup_cached(ResourceId)
|
emqx_resource_manager:lookup_cached(ResourceId)
|
||||||
),
|
),
|
||||||
%% now create the topic and restart the bridge
|
%% now create the topic and restart the bridge
|
||||||
|
|
|
@ -642,7 +642,6 @@ status_to_error(_) ->
|
||||||
{error, undefined}.
|
{error, undefined}.
|
||||||
|
|
||||||
%% Compatibility
|
%% Compatibility
|
||||||
external_error({error, {unhealthy_target, Message}}) -> Message;
|
|
||||||
external_error({error, Reason}) -> Reason;
|
external_error({error, Reason}) -> Reason;
|
||||||
external_error(Other) -> Other.
|
external_error(Other) -> Other.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue