mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-17 15:19:46 +00:00
remove file on failed download
This commit is contained in:
parent
5358eaa251
commit
d67d679baf
2 changed files with 5 additions and 9 deletions
|
|
@ -256,7 +256,8 @@ class S3FilesImpl(Files):
|
|||
content = response["Body"].read()
|
||||
except ClientError as e:
|
||||
if e.response["Error"]["Code"] == "NoSuchKey":
|
||||
raise ResourceNotFoundError(row["id"], "File content", "files.list()") from e
|
||||
await self.sql_store.delete("openai_files", where={"id": file_id})
|
||||
raise ResourceNotFoundError(file_id, "File", "files.list()") from e
|
||||
raise RuntimeError(f"Failed to download file from S3: {e}") from e
|
||||
|
||||
return Response(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue