99 EC2AccessError ,
1010 EC2InstanceNotFoundError ,
1111 EC2InstanceTypeInvalidError ,
12- EC2InsufficientCapacityError ,
1312 EC2NotConnectedError ,
1413 EC2RuntimeError ,
1514 EC2TimeoutError ,
3029def _map_botocore_client_exception (
3130 botocore_error : botocore_exc .ClientError ,
3231 * args , # pylint: disable=unused-argument # noqa: ARG001
33- ** kwargs ,
32+ ** kwargs , # pylint: disable=unused-argument # noqa: ARG001
3433) -> EC2AccessError :
3534 status_code = int (
3635 botocore_error .response .get ("ResponseMetadata" , {}).get ("HTTPStatusCode" )
3736 or botocore_error .response .get ("Error" , {}).get ("Code" , - 1 )
3837 )
3938 operation_name = botocore_error .operation_name
40- error_code = botocore_error .response .get ("Error" , {}).get ("Code" )
41-
4239 match status_code , operation_name :
4340 case 400 , "StartInstances" :
4441 return EC2InstanceNotFoundError ()
@@ -49,12 +46,6 @@ def _map_botocore_client_exception(
4946 case 400 , "DescribeInstanceTypes" :
5047 return EC2InstanceTypeInvalidError ()
5148 case _:
52- # Check for specific error codes regardless of HTTP status
53- if error_code == "InsufficientInstanceCapacity" :
54- return EC2InsufficientCapacityError (
55- subnet_id = kwargs .get ("subnet_id" , "unknown" ),
56- instance_type = kwargs .get ("instance_type" , "unknown" ),
57- )
5849 return EC2AccessError (
5950 operation_name = operation_name ,
6051 code = status_code ,
0 commit comments