9
9
EC2AccessError ,
10
10
EC2InstanceNotFoundError ,
11
11
EC2InstanceTypeInvalidError ,
12
- EC2InsufficientCapacityError ,
13
12
EC2NotConnectedError ,
14
13
EC2RuntimeError ,
15
14
EC2TimeoutError ,
30
29
def _map_botocore_client_exception (
31
30
botocore_error : botocore_exc .ClientError ,
32
31
* args , # pylint: disable=unused-argument # noqa: ARG001
33
- ** kwargs ,
32
+ ** kwargs , # pylint: disable=unused-argument # noqa: ARG001
34
33
) -> EC2AccessError :
35
34
status_code = int (
36
35
botocore_error .response .get ("ResponseMetadata" , {}).get ("HTTPStatusCode" )
37
36
or botocore_error .response .get ("Error" , {}).get ("Code" , - 1 )
38
37
)
39
38
operation_name = botocore_error .operation_name
40
- error_code = botocore_error .response .get ("Error" , {}).get ("Code" )
41
-
42
39
match status_code , operation_name :
43
40
case 400 , "StartInstances" :
44
41
return EC2InstanceNotFoundError ()
@@ -49,12 +46,6 @@ def _map_botocore_client_exception(
49
46
case 400 , "DescribeInstanceTypes" :
50
47
return EC2InstanceTypeInvalidError ()
51
48
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
- )
58
49
return EC2AccessError (
59
50
operation_name = operation_name ,
60
51
code = status_code ,
0 commit comments