@@ -2305,12 +2305,8 @@ incoming_link_transfer(
2305
2305
" delivery_tag=~p , delivery_id=~p , reason=~p " ,
2306
2306
[DeliveryTag , DeliveryId , Reason ])
2307
2307
end ;
2308
- {error , not_found , XName } ->
2308
+ {error , # 'v1_0.error' {} = Err } ->
2309
2309
Disposition = released (DeliveryId ),
2310
- Description = unicode :characters_to_binary (" no " ++ rabbit_misc :rs (XName )),
2311
- Err = # 'v1_0.error' {
2312
- condition = ? V_1_0_AMQP_ERROR_NOT_FOUND ,
2313
- description = {utf8 , Description }},
2314
2310
Detach = detach (HandleInt , Link0 , Err ),
2315
2311
{error , [Disposition , Detach ]}
2316
2312
end .
@@ -2322,7 +2318,7 @@ lookup_target(#resource{} = XName, LinkRKey, Mc, _, _, PermCache) ->
2322
2318
{ok , X } ->
2323
2319
lookup_routing_key (X , LinkRKey , Mc , PermCache );
2324
2320
{error , not_found } ->
2325
- {error , not_found , XName }
2321
+ {error , error_not_found ( XName ) }
2326
2322
end ;
2327
2323
lookup_target (to , to , Mc , Vhost , User , PermCache0 ) ->
2328
2324
case mc :property (to , Mc ) of
@@ -2336,19 +2332,19 @@ lookup_target(to, to, Mc, Vhost, User, PermCache0) ->
2336
2332
check_internal_exchange (X ),
2337
2333
lookup_routing_key (X , RKey , Mc , PermCache );
2338
2334
{error , not_found } ->
2339
- {error , not_found , XName }
2335
+ {error , error_not_found ( XName ) }
2340
2336
end ;
2341
2337
{error , bad_address } ->
2342
- protocol_error (
2343
- ? V_1_0_AMQP_ERROR_PRECONDITION_FAILED ,
2344
- " bad 'to' address string: ~ts " ,
2345
- [ String ])
2338
+ { error ,
2339
+ # 'v1_0.error' {
2340
+ condition = ? V_1_0_AMQP_ERROR_PRECONDITION_FAILED ,
2341
+ description = { utf8 , << " bad 'to' address string: " , String / binary >>}}}
2346
2342
end ;
2347
2343
undefined ->
2348
- protocol_error (
2349
- ? V_1_0_AMQP_ERROR_PRECONDITION_FAILED ,
2350
- " anonymous terminus requires 'to' address to be set " ,
2351
- [])
2344
+ { error ,
2345
+ # 'v1_0.error' {
2346
+ condition = ? V_1_0_AMQP_ERROR_PRECONDITION_FAILED ,
2347
+ description = { utf8 , << " anonymous terminus requires 'to' address to be set " >>}}}
2352
2348
end .
2353
2349
2354
2350
lookup_routing_key (X = # exchange {name = # resource {name = XNameBin }},
@@ -2430,7 +2426,7 @@ maybe_grant_mgmt_link_credit(Credit, _, _) ->
2430
2426
{ok , rabbit_amqqueue :name (), permission_cache (), topic_permission_cache ()} |
2431
2427
{error , term ()}.
2432
2428
ensure_source (# 'v1_0.source' {dynamic = true }, _ , _ , _ , _ ) ->
2433
- not_implemented (" Dynamic sources not supported" );
2429
+ exit_not_implemented (" Dynamic sources not supported" );
2434
2430
ensure_source (# 'v1_0.source' {address = Address ,
2435
2431
durable = Durable },
2436
2432
Vhost , User , PermCache , TopicPermCache ) ->
@@ -2504,7 +2500,7 @@ ensure_source_v2(Address, _, _, _) ->
2504
2500
permission_cache ()} |
2505
2501
{error , term ()}.
2506
2502
ensure_target (# 'v1_0.target' {dynamic = true }, _ , _ , _ ) ->
2507
- not_implemented (" Dynamic targets not supported" );
2503
+ exit_not_implemented (" Dynamic targets not supported" );
2508
2504
ensure_target (# 'v1_0.target' {address = Address ,
2509
2505
durable = Durable },
2510
2506
Vhost , User , PermCache ) ->
@@ -2549,7 +2545,7 @@ check_exchange(XNameBin, RKey, QNameBin, User, Vhost, PermCache0) ->
2549
2545
end ,
2550
2546
{ok , Exchange , RKey , QNameBin , PermCache };
2551
2547
{error , not_found } ->
2552
- not_found (XName )
2548
+ exit_not_found (XName )
2553
2549
end .
2554
2550
2555
2551
ensure_target_v1 ({utf8 , Address }, Vhost , User , Durable , PermCache0 ) ->
@@ -2908,16 +2904,16 @@ keyfind_unpack_described(Key, KvList) ->
2908
2904
end .
2909
2905
2910
2906
validate_attach (# 'v1_0.attach' {target = # 'v1_0.coordinator' {}}) ->
2911
- not_implemented (" Transactions not supported" );
2907
+ exit_not_implemented (" Transactions not supported" );
2912
2908
validate_attach (# 'v1_0.attach' {unsettled = {map , [_ |_ ]}}) ->
2913
- not_implemented (" Link recovery not supported" );
2909
+ exit_not_implemented (" Link recovery not supported" );
2914
2910
validate_attach (# 'v1_0.attach' {incomplete_unsettled = true }) ->
2915
- not_implemented (" Link recovery not supported" );
2911
+ exit_not_implemented (" Link recovery not supported" );
2916
2912
validate_attach (
2917
2913
# 'v1_0.attach' {snd_settle_mode = SndSettleMode ,
2918
2914
rcv_settle_mode = ? V_1_0_RECEIVER_SETTLE_MODE_SECOND })
2919
2915
when SndSettleMode =/= ? V_1_0_SENDER_SETTLE_MODE_SETTLED ->
2920
- not_implemented (" rcv-settle-mode second not supported" );
2916
+ exit_not_implemented (" rcv-settle-mode second not supported" );
2921
2917
validate_attach (# 'v1_0.attach' {}) ->
2922
2918
ok .
2923
2919
@@ -2951,7 +2947,7 @@ validate_multi_transfer_settled(Other, First)
2951
2947
% % "If the message is being sent settled by the sender,
2952
2948
% % the value of this field [rcv-settle-mode] is ignored." [2.7.5]
2953
2949
validate_transfer_rcv_settle_mode (? V_1_0_RECEIVER_SETTLE_MODE_SECOND , _Settled = false ) ->
2954
- not_implemented (" rcv-settle-mode second not supported" );
2950
+ exit_not_implemented (" rcv-settle-mode second not supported" );
2955
2951
validate_transfer_rcv_settle_mode (_ , _ ) ->
2956
2952
ok .
2957
2953
@@ -3025,7 +3021,7 @@ exit_if_absent(ResourceName = #resource{kind = Kind}) ->
3025
3021
end ,
3026
3022
case Mod :exists (ResourceName ) of
3027
3023
true -> ok ;
3028
- false -> not_found (ResourceName )
3024
+ false -> exit_not_found (ResourceName )
3029
3025
end .
3030
3026
3031
3027
generate_queue_name () ->
@@ -3072,10 +3068,10 @@ outcomes(#'v1_0.source'{outcomes = {array, symbol, Syms} = Outcomes}) ->
3072
3068
[] ->
3073
3069
Outcomes ;
3074
3070
Unsupported ->
3075
- not_implemented (" Outcomes not supported: ~tp " , [Unsupported ])
3071
+ exit_not_implemented (" Outcomes not supported: ~tp " , [Unsupported ])
3076
3072
end ;
3077
3073
outcomes (# 'v1_0.source' {outcomes = Unsupported }) ->
3078
- not_implemented (" Outcomes not supported: ~tp " , [Unsupported ]);
3074
+ exit_not_implemented (" Outcomes not supported: ~tp " , [Unsupported ]);
3079
3075
outcomes (_ ) ->
3080
3076
{array , symbol , ? OUTCOMES }.
3081
3077
@@ -3330,30 +3326,37 @@ check_paired({map, Properties}) ->
3330
3326
true ->
3331
3327
ok ;
3332
3328
false ->
3333
- property_paired_not_set ()
3329
+ exit_property_paired_not_set ()
3334
3330
end ;
3335
3331
check_paired (_ ) ->
3336
- property_paired_not_set ().
3332
+ exit_property_paired_not_set ().
3337
3333
3338
- -spec property_paired_not_set () -> no_return ().
3339
- property_paired_not_set () ->
3334
+ -spec exit_property_paired_not_set () -> no_return ().
3335
+ exit_property_paired_not_set () ->
3340
3336
protocol_error (? V_1_0_AMQP_ERROR_INVALID_FIELD ,
3341
3337
" Link property 'paired' is not set to boolean value 'true'" , []).
3342
3338
3343
- -spec not_implemented (io :format ()) -> no_return ().
3344
- not_implemented (Format ) ->
3345
- not_implemented (Format , []).
3339
+ -spec exit_not_implemented (io :format ()) -> no_return ().
3340
+ exit_not_implemented (Format ) ->
3341
+ exit_not_implemented (Format , []).
3346
3342
3347
- -spec not_implemented (io :format (), [term ()]) -> no_return ().
3348
- not_implemented (Format , Args ) ->
3343
+ -spec exit_not_implemented (io :format (), [term ()]) -> no_return ().
3344
+ exit_not_implemented (Format , Args ) ->
3349
3345
protocol_error (? V_1_0_AMQP_ERROR_NOT_IMPLEMENTED , Format , Args ).
3350
3346
3351
- -spec not_found (rabbit_types :r (exchange | queue )) -> no_return ().
3352
- not_found (Resource ) ->
3347
+ -spec exit_not_found (rabbit_types :r (exchange | queue )) -> no_return ().
3348
+ exit_not_found (Resource ) ->
3353
3349
protocol_error (? V_1_0_AMQP_ERROR_NOT_FOUND ,
3354
3350
" no ~ts " ,
3355
3351
[rabbit_misc :rs (Resource )]).
3356
3352
3353
+ -spec error_not_found (rabbit_types :r (exchange | queue )) -> # 'v1_0.error' {}.
3354
+ error_not_found (Resource ) ->
3355
+ Description = unicode :characters_to_binary (" no " ++ rabbit_misc :rs (Resource )),
3356
+ # 'v1_0.error' {
3357
+ condition = ? V_1_0_AMQP_ERROR_NOT_FOUND ,
3358
+ description = {utf8 , Description }}.
3359
+
3357
3360
address_v1_permitted () ->
3358
3361
rabbit_deprecated_features :is_permitted (amqp_address_v1 ).
3359
3362
0 commit comments