summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-08-06 19:01:08 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-08-06 19:01:08 +0100
commit6a006b0aeab79429dcf7772a76154b4de9f0f074 (patch)
treef39d8ddbebc9f35604d9ddb54e78dc581cb8cebb
parentfc01052aeee50e2e5eb71fb160c91ff62248cdc3 (diff)
downloadrabbitmq-server-bug23039.tar.gz
include method name in error if possiblebug23039
-rw-r--r--src/rabbit_framing_channel.erl38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/rabbit_framing_channel.erl b/src/rabbit_framing_channel.erl
index 5ef54268..553faaa8 100644
--- a/src/rabbit_framing_channel.erl
+++ b/src/rabbit_framing_channel.erl
@@ -85,16 +85,16 @@ mainloop(Parent, ChannelPid, Protocol) ->
rabbit_channel:do(ChannelPid, Method, Content),
?MODULE:mainloop(Parent, ChannelPid, Protocol);
{error, Reason} ->
- channel_exit(Parent, Reason)
+ channel_exit(Parent, Reason, MethodName)
end;
false -> rabbit_channel:do(ChannelPid, Method),
?MODULE:mainloop(Parent, ChannelPid, Protocol)
end;
_ ->
- channel_exit(Parent, unexpected_frame(
- "expected method frame, "
- "got non method frame instead",
- []))
+ channel_exit(Parent, {unexpected_frame,
+ "expected method frame, "
+ "got non method frame instead",
+ []}, none)
end.
collect_content(ChannelPid, ClassId, Protocol) ->
@@ -110,13 +110,15 @@ collect_content(ChannelPid, ClassId, Protocol) ->
Error -> Error
end;
{content_header, HeaderClassId, 0, _BodySize, _PropertiesBin} ->
- {error, unexpected_frame("expected content header for class ~w, "
- "got one for class ~w instead",
- [ClassId, HeaderClassId])};
+ {error, {unexpected_frame,
+ "expected content header for class ~w, "
+ "got one for class ~w instead",
+ [ClassId, HeaderClassId]}};
_ ->
- {error, unexpected_frame("expected content header for class ~w, "
- "got non content header frame instead",
- [ClassId])}
+ {error, {unexpected_frame,
+ "expected content header for class ~w, "
+ "got non content header frame instead",
+ [ClassId]}}
end.
collect_content_payload(_ChannelPid, 0, Acc) ->
@@ -128,13 +130,13 @@ collect_content_payload(ChannelPid, RemainingByteCount, Acc) ->
RemainingByteCount - size(FragmentBin),
[FragmentBin | Acc]);
_ ->
- {error, unexpected_frame("expected content body, "
- "got non content body frame instead",
- [])}
+ {error, {unexpected_frame,
+ "expected content body, "
+ "got non content body frame instead",
+ []}}
end.
-unexpected_frame(ExplanationFormat, Params) ->
- rabbit_misc:amqp_error(unexpected_frame, ExplanationFormat, Params, none).
-
-channel_exit(Parent, Reason) ->
+channel_exit(Parent, {ErrorName, ExplanationFormat, Params}, MethodName) ->
+ Reason = rabbit_misc:amqp_error(ErrorName, ExplanationFormat, Params,
+ MethodName),
Parent ! {channel_exit, self(), Reason}.