@@ -126,6 +126,7 @@ handle_http_req(HttpMethod = <<"PUT">>,
126
126
ok = prohibit_reserved_amq (QName ),
127
127
PermCache1 = check_resource_access (QName , configure , User , PermCache0 ),
128
128
rabbit_core_metrics :queue_declared (QName ),
129
+
129
130
{Q1 , NumMsgs , NumConsumers , StatusCode , PermCache } =
130
131
case rabbit_amqqueue :with (
131
132
QName ,
@@ -146,36 +147,34 @@ handle_http_req(HttpMethod = <<"PUT">>,
146
147
Result ;
147
148
{error , not_found } ->
148
149
PermCache2 = check_dead_letter_exchange (QName , QArgs , User , PermCache1 ),
149
- try case rabbit_amqqueue :declare (
150
- QName , Durable , AutoDelete , QArgs , Owner , Username ) of
151
- {new , Q } ->
150
+ try rabbit_amqqueue :declare (
151
+ QName , Durable , AutoDelete , QArgs , Owner , Username ) of
152
+ {new , Q } ->
152
153
rabbit_core_metrics :queue_created (QName ),
153
154
{Q , 0 , 0 , <<" 201" >>, PermCache2 };
154
- {owner_died , Q } ->
155
+ {owner_died , Q } ->
155
156
% % Presumably our own days are numbered since the
156
157
% % connection has died. Pretend the queue exists though,
157
158
% % just so nothing fails.
158
159
{Q , 0 , 0 , <<" 201" >>, PermCache2 };
159
- {absent , Q , Reason } ->
160
+ {absent , Q , Reason } ->
160
161
absent (Q , Reason );
161
- {existing , _Q } ->
162
+ {existing , _Q } ->
162
163
% % Must have been created in the meantime. Loop around again.
163
164
handle_http_req (HttpMethod , PathSegments , Query , ReqPayload ,
164
- Vhost , User , ConnPid , {PermCache2 , TopicPermCache });
165
- {error , queue_limit_exceeded , Reason , ReasonArgs } ->
165
+ Vhost , User , ConnPid , {PermCache2 , TopicPermCache });
166
+ {error , queue_limit_exceeded , Reason , ReasonArgs } ->
166
167
throw (<<" 403" >>,
167
- Reason ,
168
- ReasonArgs );
169
- {protocol_error , _ErrorType , Reason , ReasonArgs } ->
168
+ Reason ,
169
+ ReasonArgs );
170
+ {protocol_error , _ErrorType , Reason , ReasonArgs } ->
170
171
throw (<<" 400" >>, Reason , ReasonArgs )
171
- end
172
172
catch exit :# amqp_error {name = precondition_failed ,
173
- explanation = Expl } ->
174
- throw (<<" 409" >>, Expl , []);
175
- exit :# amqp_error {explanation = Expl } ->
176
- throw (<<" 400" >>, Expl , [])
173
+ explanation = Expl } ->
174
+ throw (<<" 409" >>, Expl , []);
175
+ exit :# amqp_error {explanation = Expl } ->
176
+ throw (<<" 400" >>, Expl , [])
177
177
end ;
178
-
179
178
{error , {absent , Q , Reason }} ->
180
179
absent (Q , Reason )
181
180
end ,
0 commit comments