diff options
author | Alvaro Videla <alvaro@rabbitmq.com> | 2014-04-29 16:29:34 +0200 |
---|---|---|
committer | Alvaro Videla <alvaro@rabbitmq.com> | 2014-04-29 16:29:34 +0200 |
commit | 6444cdd4edad85721bd2f1f80e5fbfb2b2e8146e (patch) | |
tree | a538ce91d89cb267fae89e518d7d8965e9c37285 | |
parent | 68366c7f6a7a27901a9ae07d5636f35bfaa65faf (diff) | |
download | rabbitmq-server-6444cdd4edad85721bd2f1f80e5fbfb2b2e8146e.tar.gz |
updates intercept callback signature
-rw-r--r-- | src/rabbit_channel_interceptor.erl | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/rabbit_channel_interceptor.erl b/src/rabbit_channel_interceptor.erl index 0dbdf5ac..d27dc8b9 100644 --- a/src/rabbit_channel_interceptor.erl +++ b/src/rabbit_channel_interceptor.erl @@ -33,7 +33,7 @@ -callback description() -> [proplists:property()]. -callback intercept(original_method(), rabbit_types:vhost()) -> - {ok, processed_method()} | rabbit_misc:channel_or_connection_exit(). + processed_method() | rabbit_misc:channel_or_connection_exit(). %% Whether the interceptor wishes to intercept the amqp method -callback applies_to(intercept_method()) -> boolean(). @@ -62,20 +62,15 @@ intercept_method(M, VHost) -> intercept_method(M, _VHost, []) -> M; intercept_method(M, VHost, [I]) -> - case I:intercept(M, VHost) of - {ok, M2} -> - case validate_method(M, M2) of - true -> - M2; - _ -> - precondition_failed("Interceptor: ~p expected " - "to return method: ~p but returned: ~p", - [I, rabbit_misc:method_record_type(M), - rabbit_misc:method_record_type(M2)]) - end; - {error, Reason} -> - precondition_failed("Interceptor: ~p failed with reason: ~p", - [I, Reason]) + M2 = I:intercept(M, VHost), + case validate_method(M, M2) of + true -> + M2; + _ -> + precondition_failed("Interceptor: ~p expected " + "to return method: ~p but returned: ~p", + [I, rabbit_misc:method_record_type(M), + rabbit_misc:method_record_type(M2)]) end; intercept_method(M, _VHost, Is) -> precondition_failed("More than one interceptor for method: ~p -- ~p", |