@@ -1313,14 +1313,24 @@ def disable(
1313
1313
),
1314
1314
),
1315
1315
request = req ,
1316
- error_status_codes = ["4XX" , "5XX" ],
1316
+ error_status_codes = ["401" , "403" , "404" , "429" , " 4XX" , "500" , "504 " , "5XX" ],
1317
1317
retry_config = retry_config ,
1318
1318
)
1319
1319
1320
1320
if utils .match_response (http_res , "204" , "*" ):
1321
1321
return operations .DisablePaymentLinkResponse (
1322
1322
headers = utils .get_response_headers (http_res .headers )
1323
1323
)
1324
+ if utils .match_response (http_res , ["401" , "403" , "404" , "429" ], "*" ):
1325
+ http_res_text = utils .stream_to_text (http_res )
1326
+ raise errors .APIError (
1327
+ "API error occurred" , http_res .status_code , http_res_text , http_res
1328
+ )
1329
+ if utils .match_response (http_res , ["500" , "504" ], "*" ):
1330
+ http_res_text = utils .stream_to_text (http_res )
1331
+ raise errors .APIError (
1332
+ "API error occurred" , http_res .status_code , http_res_text , http_res
1333
+ )
1324
1334
if utils .match_response (http_res , "4XX" , "*" ):
1325
1335
http_res_text = utils .stream_to_text (http_res )
1326
1336
raise errors .APIError (
@@ -1415,14 +1425,24 @@ async def disable_async(
1415
1425
),
1416
1426
),
1417
1427
request = req ,
1418
- error_status_codes = ["4XX" , "5XX" ],
1428
+ error_status_codes = ["401" , "403" , "404" , "429" , " 4XX" , "500" , "504 " , "5XX" ],
1419
1429
retry_config = retry_config ,
1420
1430
)
1421
1431
1422
1432
if utils .match_response (http_res , "204" , "*" ):
1423
1433
return operations .DisablePaymentLinkResponse (
1424
1434
headers = utils .get_response_headers (http_res .headers )
1425
1435
)
1436
+ if utils .match_response (http_res , ["401" , "403" , "404" , "429" ], "*" ):
1437
+ http_res_text = await utils .stream_to_text_async (http_res )
1438
+ raise errors .APIError (
1439
+ "API error occurred" , http_res .status_code , http_res_text , http_res
1440
+ )
1441
+ if utils .match_response (http_res , ["500" , "504" ], "*" ):
1442
+ http_res_text = await utils .stream_to_text_async (http_res )
1443
+ raise errors .APIError (
1444
+ "API error occurred" , http_res .status_code , http_res_text , http_res
1445
+ )
1426
1446
if utils .match_response (http_res , "4XX" , "*" ):
1427
1447
http_res_text = await utils .stream_to_text_async (http_res )
1428
1448
raise errors .APIError (
0 commit comments