refactor(add-log): log when subscription fails
This commit is contained in:
parent
1c316cb5f0
commit
00bc525d8e
|
@ -540,6 +540,7 @@ process_subscribe([{TopicFilter, SubOpts}|More], SubProps, Channel, Acc) ->
|
||||||
{RC, NChannel} = do_subscribe(TopicFilter, SubOpts#{sub_props => SubProps}, Channel),
|
{RC, NChannel} = do_subscribe(TopicFilter, SubOpts#{sub_props => SubProps}, Channel),
|
||||||
process_subscribe(More, SubProps, NChannel, [RC|Acc]);
|
process_subscribe(More, SubProps, NChannel, [RC|Acc]);
|
||||||
{error, RC} ->
|
{error, RC} ->
|
||||||
|
?LOG(warning, "Cannot subscribe ~s due to ~s.", [TopicFilter, emqx_reason_codes:text(RC)]),
|
||||||
process_subscribe(More, SubProps, Channel, [RC|Acc])
|
process_subscribe(More, SubProps, Channel, [RC|Acc])
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -552,6 +553,7 @@ do_subscribe(TopicFilter, SubOpts = #{qos := QoS}, Channel =
|
||||||
{ok, NSession} ->
|
{ok, NSession} ->
|
||||||
{QoS, Channel#channel{session = NSession}};
|
{QoS, Channel#channel{session = NSession}};
|
||||||
{error, RC} ->
|
{error, RC} ->
|
||||||
|
?LOG(warning, "Cannot subscribe ~s due to ~s.", [TopicFilter, emqx_reason_codes:text(RC)]),
|
||||||
{RC, Channel}
|
{RC, Channel}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue