浏览代码

fix: improve error handling for file retrieval in AwsS3Storage (#12002)

Signed-off-by: -LAN- <laipz8200@outlook.com>
-LAN- 4 月之前
父节点
当前提交
c4091c4c66
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      api/extensions/storage/aws_s3_storage.py

+ 3 - 1
api/extensions/storage/aws_s3_storage.py

@@ -67,7 +67,9 @@ class AwsS3Storage(BaseStorage):
             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