summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <michael@rabbitmq.com>2013-11-29 12:49:34 +0400
committerMichael Klishin <michael@rabbitmq.com>2013-11-29 12:49:34 +0400
commit193e12b86a8ea4d8903371a92649a1437b2fac12 (patch)
treee0cd56b32bb5dac091f8762770c67a86f30a7768
parentb27bb04b250e1a921e6975b102c7e86ab8115701 (diff)
downloadrabbitmq-server-git-193e12b86a8ea4d8903371a92649a1437b2fac12.tar.gz
Use rabbit_misc:protocol_error and catch exits
-rw-r--r--src/rabbit_reader.erl11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 4e268f4503..023d0da9f7 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -614,12 +614,9 @@ create_channel(Channel, State) ->
N = length(all_channels()),
case ChannelMax /= 0 andalso N + 1 > ChannelMax of
true ->
- %% we cannot use rabbit_misc:protocol_error here because amqp_error is caught
- %% only for the methods on channel 0.
- AmqpError = rabbit_misc:amqp_error(
- not_allowed, "number of channels opened (~w) has reached the negotiated channel_max (~w)",
- [N, ChannelMax], 'none'),
- throw({error, AmqpError});
+ rabbit_misc:protocol_error(
+ not_allowed, "number of channels opened (~w) has reached the negotiated channel_max (~w)",
+ [N, ChannelMax], 'none');
false ->
{ok, _ChSupPid, {ChPid, AState}} =
rabbit_channel_sup_sup:start_channel(
@@ -697,7 +694,7 @@ process_frame(Frame, Channel, State) ->
{error, Reason} ->
handle_exception(State, Channel, Reason)
end
- catch {error, Error} ->
+ catch exit:Error ->
handle_exception(State, Channel, Error)
end.