Don't log exception if object doesn't exist (#3724)
Browse files### 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)
- rag/utils/minio_conn.py +5 -1
rag/utils/minio_conn.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import logging
|
2 |
import time
|
3 |
from minio import Minio
|
|
|
4 |
from io import BytesIO
|
5 |
from rag import settings
|
6 |
from rag.utils import singleton
|
@@ -84,8 +85,11 @@ class RAGFlowMinio(object):
|
|
84 |
return True
|
85 |
else:
|
86 |
return False
|
|
|
|
|
|
|
87 |
except Exception:
|
88 |
-
logging.exception(f"
|
89 |
return False
|
90 |
|
91 |
def get_presigned_url(self, bucket, fnm, expires):
|
|
|
1 |
import logging
|
2 |
import time
|
3 |
from minio import Minio
|
4 |
+
from minio.error import S3Error
|
5 |
from io import BytesIO
|
6 |
from rag import settings
|
7 |
from rag.utils import singleton
|
|
|
85 |
return True
|
86 |
else:
|
87 |
return False
|
88 |
+
except S3Error as e:
|
89 |
+
if e.code in ["NoSuchKey", "NoSuchBucket", "ResourceNotFound"]:
|
90 |
+
return False
|
91 |
except Exception:
|
92 |
+
logging.exception(f"obj_exist {bucket}/{filename} got exception")
|
93 |
return False
|
94 |
|
95 |
def get_presigned_url(self, bucket, fnm, expires):
|