diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2010-07-09 14:25:44 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2010-07-09 14:25:44 +0100 |
| commit | 9b3784c4c4ae45f145e62b756680ac748b4d06e1 (patch) | |
| tree | fcd05f0f9a6021a0fbaa8d8859c805c22b12514b | |
| parent | ff90a4a0698e2682548d922fd6c0cbec178fb2e5 (diff) | |
| download | rabbitmq-server-git-9b3784c4c4ae45f145e62b756680ac748b4d06e1.tar.gz | |
refactor: extract error helper
| -rw-r--r-- | src/rabbit_framing_channel.erl | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/rabbit_framing_channel.erl b/src/rabbit_framing_channel.erl index 6f14371f16..cb06ac7bc6 100644 --- a/src/rabbit_framing_channel.erl +++ b/src/rabbit_framing_channel.erl @@ -85,10 +85,9 @@ mainloop(ChannelPid) -> end, ?MODULE:mainloop(ChannelPid); _ -> - rabbit_misc:protocol_error( - unexpected_frame, - "expected method frame, got non method frame instead", - []) + unexpected_frame("expected method frame, " + "got non method frame instead", + []) end. collect_content(ChannelPid, ClassId) -> @@ -100,17 +99,13 @@ collect_content(ChannelPid, ClassId) -> properties_bin = PropertiesBin, payload_fragments_rev = Payload}; {content_header, HeaderClassId, 0, _BodySize, _PropertiesBin} -> - rabbit_misc:protocol_error( - unexpected_frame, - "expected content header for class ~w, " - "got one for class ~w instead", - [ClassId, HeaderClassId]); + unexpected_frame("expected content header for class ~w, " + "got one for class ~w instead", + [ClassId, HeaderClassId]); _ -> - rabbit_misc:protocol_error( - unexpected_frame, - "expected content header for class ~w, " - "got non content header frame instead", - [ClassId]) + unexpected_frame("expected content header for class ~w, " + "got non content header frame instead", + [ClassId]) end. collect_content_payload(_ChannelPid, 0, Acc) -> @@ -122,8 +117,10 @@ collect_content_payload(ChannelPid, RemainingByteCount, Acc) -> RemainingByteCount - size(FragmentBin), [FragmentBin | Acc]); _ -> - rabbit_misc:protocol_error( - unexpected_frame, - "expected content body, got non content body frame instead", - []) + unexpected_frame("expected content body, " + "got non content body frame instead", + []) end. + +unexpected_frame(ExplanationFormat, Params) -> + rabbit_misc:protocol_error(unexpected_frame, ExplanationFormat, Params). |
