Skip to content

Commit 54ed70f

Browse files
committed
Include error reason in shovel log
Ignoring exception class and pattern makes debugging hard. (cherry picked from commit 58360b5)
1 parent fd340cc commit 54ed70f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

deps/rabbitmq_shovel/src/rabbit_shovel_worker.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ handle_cast(init, State = #state{config = Config0}) ->
7070
%% rabbitmq/rabbitmq-shovel#54 for context.
7171
gen_server2:cast(self(), connect_dest),
7272
{noreply, State#state{config = Config}}
73-
catch _:_ ->
74-
rabbit_log_shovel:error("Shovel ~ts could not connect to source", [human_readable_name(maps:get(name, Config0))]),
73+
catch E:R ->
74+
rabbit_log_shovel:error("Shovel ~ts could not connect to source: ~p ~p", [human_readable_name(maps:get(name, Config0)), E, R]),
7575
{stop, shutdown, State}
7676
end;
7777
handle_cast(connect_dest, State = #state{config = Config0}) ->
@@ -80,8 +80,8 @@ handle_cast(connect_dest, State = #state{config = Config0}) ->
8080
rabbit_log_shovel:debug("Shovel ~ts connected to destination", [human_readable_name(maps:get(name, Config))]),
8181
gen_server2:cast(self(), init_shovel),
8282
{noreply, State#state{config = Config}}
83-
catch _:_ ->
84-
rabbit_log_shovel:error("Shovel ~ts could not connect to destination", [human_readable_name(maps:get(name, Config0))]),
83+
catch E:R ->
84+
rabbit_log_shovel:error("Shovel ~ts could not connect to destination: ~p ~p", [human_readable_name(maps:get(name, Config0)), E, R]),
8585
{stop, shutdown, State}
8686
end;
8787
handle_cast(init_shovel, State = #state{config = Config}) ->

0 commit comments

Comments
 (0)