fix: treat all returns except {error, Reason} as ok

This commit is contained in:
Shawn 2022-04-18 22:02:22 +08:00
parent 21fe7f01ee
commit 5f74db6d88
1 changed files with 5 additions and 4 deletions

View File

@ -97,11 +97,12 @@ on_message_publish(Message = #message{topic = Topic, flags = Flags}) ->
send_to_matched_egress_bridges(Topic, Msg) -> send_to_matched_egress_bridges(Topic, Msg) ->
lists:foreach(fun (Id) -> lists:foreach(fun (Id) ->
try send_message(Id, Msg) of try send_message(Id, Msg) of
ok -> ok; {error, Reason} ->
Error -> ?SLOG(error, #{msg => "send_message_to_bridge_failed", ?SLOG(error, #{msg => "send_message_to_bridge_failed",
bridge => Id, error => Error}) bridge => Id, error => Reason});
_ -> ok
catch Err:Reason:ST -> catch Err:Reason:ST ->
?SLOG(error, #{msg => "send_message_to_bridge_crash", ?SLOG(error, #{msg => "send_message_to_bridge_exception",
bridge => Id, error => Err, reason => Reason, bridge => Id, error => Err, reason => Reason,
stacktrace => ST}) stacktrace => ST})
end end