Skip to content

Commit df33091

Browse files
authored
Change boto3 retrieval error from exception to warning (boostorg#1956) (boostorg#1971)
1 parent 029756e commit df33091

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

core/boostrenderer.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,10 @@ def get_file_data(client, bucket_name, s3_key):
157157
response = client.get_object(Bucket=bucket_name, Key=s3_key.lstrip("/"))
158158
return extract_file_data(response, s3_key)
159159
except ClientError as e:
160-
# Log the exception but ignore it otherwise, since it's not necessarily an error
161-
logger.exception(
162-
"get_content_from_s3_error",
163-
s3_key=s3_key,
164-
error=str(e),
165-
function_name="get_content_from_s3",
166-
)
167-
return
160+
if e.response["Error"]["Code"] == "NoSuchKey":
161+
logger.warning(f"NoSuchKey {s3_key=}")
162+
else:
163+
logger.exception(f"get_content_from_s3_client_error {s3_key=}, {str(e)=}")
168164

169165

170166
def get_s3_client():

0 commit comments

Comments
 (0)