Skip to content

Commit

Permalink
Don't log exception if object doesn't exist (#3724)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

Don't log exception if object doesn't exist. Close #1483

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
yuzhichang authored Nov 28, 2024
1 parent 966bcda commit 80af3cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rag/utils/minio_conn.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import time
from minio import Minio
from minio.error import S3Error
from io import BytesIO
from rag import settings
from rag.utils import singleton
Expand Down Expand Up @@ -84,8 +85,11 @@ def obj_exist(self, bucket, filename):
return True
else:
return False
except S3Error as e:
if e.code in ["NoSuchKey", "NoSuchBucket", "ResourceNotFound"]:
return False
except Exception:
logging.exception(f"Not found: {bucket}/{filename}")
logging.exception(f"obj_exist {bucket}/{filename} got exception")
return False

def get_presigned_url(self, bucket, fnm, expires):
Expand Down

0 comments on commit 80af3cc

Please sign in to comment.