Skip to content

Commit

Permalink
Merge pull request #3 from sokal32/master
Browse files Browse the repository at this point in the history
Improve error logging
  • Loading branch information
5HT committed Sep 21, 2015
2 parents 8f7ca68 + c885a2a commit 9df1497
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mqs_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ handle_info({#'basic.deliver'{delivery_tag = Tag}, Message}, State) ->
Mod = Spec#mqs.'mod',
Fun = Spec#mqs.'fun',
InvokeResult = try Mod:Fun({Payload,Spec#mqs.arg,Props})
catch _:_ -> {error, msg_callback_failed} end,
catch C:T -> {error, msg_callback_failed, {C,T,erlang:get_stacktrace()}} end,
case InvokeResult of
{ok, _} -> amqp_channel:cast(State#state.channel,#'basic.ack'{delivery_tag=Tag});
{error, Reason} ->
mqs:error(?MODULE,"Error while processing received message. Reason: ~p", [Reason]),
{error, Reason, Info} ->
mqs:error(?MODULE,"Error while processing received message. Reason: ~p~nDetails: ~p~n", [Reason, Info]),
amqp_channel:cast(State#state.channel,#'basic.reject'{delivery_tag=Tag,requeue=true});
Res -> mqs:warning(?MODULE,"Unknown message processing result ~p~n",[Res]),
amqp_channel:cast(State#state.channel,#'basic.reject'{delivery_tag=Tag,requeue=true}) end,
Expand Down

0 comments on commit 9df1497

Please sign in to comment.