Skip to content

Commit

Permalink
fix: improve error handling for file retrieval in AwsS3Storage (#12002)
Browse files Browse the repository at this point in the history
Signed-off-by: -LAN- <[email protected]>
  • Loading branch information
laipz8200 authored Dec 23, 2024
1 parent ef95b12 commit c4091c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/extensions/storage/aws_s3_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ def load_stream(self, filename: str) -> Generator:
yield from response["Body"].iter_chunks()
except ClientError as ex:
if ex.response["Error"]["Code"] == "NoSuchKey":
raise FileNotFoundError("File not found")
raise FileNotFoundError("file not found")
elif "reached max retries" in str(ex):
raise ValueError("please do not request the same file too frequently")
else:
raise

Expand Down

0 comments on commit c4091c4

Please sign in to comment.