summaryrefslogtreecommitdiff
path: root/src/rabbit_writer.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/rabbit_writer.erl')
-rw-r--r--src/rabbit_writer.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/rabbit_writer.erl b/src/rabbit_writer.erl
index c3c7db53..2c7fa2ab 100644
--- a/src/rabbit_writer.erl
+++ b/src/rabbit_writer.erl
@@ -157,10 +157,15 @@ internal_send_command(Sock, Channel, MethodRecord, Content, FrameMax) ->
%% when these are full. So the fact that we process the result
%% asynchronously does not impact flow control.
internal_send_command_async(Sock, Channel, MethodRecord) ->
- true = erlang:port_command(Sock, assemble_frames(Channel, MethodRecord)),
+ true = port_cmd(Sock, assemble_frames(Channel, MethodRecord)),
ok.
internal_send_command_async(Sock, Channel, MethodRecord, Content, FrameMax) ->
- true = erlang:port_command(Sock, assemble_frames(Channel, MethodRecord,
- Content, FrameMax)),
+ true = port_cmd(Sock, assemble_frames(Channel, MethodRecord,
+ Content, FrameMax)),
ok.
+
+port_cmd(Sock, Data) ->
+ try erlang:port_command(Sock, Data)
+ catch error:Error -> exit({writer, send_failed, Error})
+ end.