summaryrefslogtreecommitdiff
path: root/src/rabbit_command_assembler.erl
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2011-01-03 13:51:59 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2011-01-03 13:51:59 +0000
commit3630b57c2b878aeae2fbbc6f57bd69f29f8e78c0 (patch)
tree0cbf71606e862013a65cb37a1f4c807bd633675e /src/rabbit_command_assembler.erl
parent5621b7e1dc52ed3c01a76580a02c1a860d25f738 (diff)
downloadrabbitmq-server-3630b57c2b878aeae2fbbc6f57bd69f29f8e78c0.tar.gz
better error handling
Diffstat (limited to 'src/rabbit_command_assembler.erl')
-rw-r--r--src/rabbit_command_assembler.erl13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rabbit_command_assembler.erl b/src/rabbit_command_assembler.erl
index ba3fbed5..f8d3260e 100644
--- a/src/rabbit_command_assembler.erl
+++ b/src/rabbit_command_assembler.erl
@@ -92,11 +92,14 @@ analyze_frame(_Type, _Body, _Protocol) ->
init(Protocol) -> {ok, {method, Protocol}}.
process({method, MethodName, FieldsBin}, {method, Protocol}) ->
- Method = Protocol:decode_method_fields(MethodName, FieldsBin),
- case Protocol:method_has_content(MethodName) of
- true -> {ClassId, _MethodId} = Protocol:method_id(MethodName),
- {ok, {content_header, Method, ClassId, Protocol}};
- false -> {ok, Method, {method, Protocol}}
+ try
+ Method = Protocol:decode_method_fields(MethodName, FieldsBin),
+ case Protocol:method_has_content(MethodName) of
+ true -> {ClassId, _MethodId} = Protocol:method_id(MethodName),
+ {ok, {content_header, Method, ClassId, Protocol}};
+ false -> {ok, Method, {method, Protocol}}
+ end
+ catch exit:#amqp_error{} = Reason -> {error, Reason}
end;
process(_Frame, {method, _Protocol}) ->
unexpected_frame("expected method frame, "