Skip to content

Commit cd730d3

Browse files
Create custom exceptions and link it to website
1 parent 881cafb commit cd730d3

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

scripts/aws/ec2.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import requests
1010
import signal
1111
import argparse
12-
from botocore.exceptions import ClientError
12+
from botocore.exceptions import ClientError, NoCredentialsError
1313
from typing import Dict
1414
import sys
1515
import time
@@ -97,14 +97,13 @@ def add_defaults(configs: Dict[str, any]) -> AWSConfidentialComputeConfig:
9797

9898
region = self.__get_current_region()
9999
print(f"Running in {region}")
100-
try:
101-
client = boto3.client("secretsmanager", region_name=region)
102-
except Exception as e:
103-
raise MissingInstanceProfile(self.__class__.__name__)
100+
client = boto3.client("secretsmanager", region_name=region)
104101
try:
105102
secret = add_defaults(json.loads(client.get_secret_value(SecretId=secret_identifier)["SecretString"]))
106103
self.__validate_aws_specific_config(secret)
107104
return secret
105+
except NoCredentialsError as _:
106+
raise MissingInstanceProfile(self.__class__.__name__)
108107
except ClientError as _:
109108
raise ConfigNotFound(self.__class__.__name__, f"{secret_identifier} in {region}")
110109

scripts/confidential_compute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, error_name, provider, extra_message):
2222
"GCP": "https://unifiedid.com/docs/guides/operator-private-gcp-confidential-space#uid2-operator-error-codes",
2323
}
2424
url = urls.get(provider)
25-
super().__init__(f"{error_name} \n" + (extra_message if extra_message else "") + f" \n Visit {url} for more details")
25+
super().__init__(f"{error_name} \n" + (extra_message if extra_message else "") + f"\nVisit {url} for more details")
2626

2727
class MissingInstanceProfile(ConfidentialComputeStartupException):
2828
def __init__(self, cls):

0 commit comments

Comments
 (0)