mirror of
https://github.com/langgenius/dify.git
synced 2026-09-05 00:31:19 +08:00
fix: replace bare except with except Exception in core agent, storage and vector backends (#40801)
This commit is contained in:
parent
dfac3e524e
commit
8031ea6d73
@ -49,7 +49,7 @@ class CotAgentOutputParser:
|
||||
json_text = re.sub(r"^[a-zA-Z]+\n", "", block.strip(), flags=re.MULTILINE)
|
||||
json_blocks.append(json.loads(json_text, strict=False))
|
||||
return json_blocks
|
||||
except:
|
||||
except Exception:
|
||||
return []
|
||||
|
||||
code_block_cache = ""
|
||||
|
||||
@ -86,7 +86,7 @@ class AwsS3Storage(BaseStorage):
|
||||
try:
|
||||
self.client.head_object(Bucket=self.bucket_name, Key=filename)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@override
|
||||
|
||||
@ -58,7 +58,7 @@ class OracleOCIStorage(BaseStorage):
|
||||
try:
|
||||
self.client.head_object(Bucket=self.bucket_name, Key=filename)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@override
|
||||
|
||||
@ -66,7 +66,7 @@ class AnalyticdbVectorOpenAPI:
|
||||
try:
|
||||
from alibabacloud_gpdb20160503.client import Client # type: ignore
|
||||
from alibabacloud_tea_openapi import models as open_api_models # type: ignore
|
||||
except:
|
||||
except Exception:
|
||||
raise ImportError(_import_err_msg)
|
||||
self._collection_name = collection_name.lower()
|
||||
self.config = config
|
||||
|
||||
@ -248,7 +248,7 @@ class LindormVectorStore(BaseVector):
|
||||
params["routing"] = self._routing
|
||||
self._client.get(index=self._collection_name, id=id, params=params)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@override
|
||||
|
||||
@ -191,7 +191,7 @@ class OpenSearchVector(BaseVector):
|
||||
try:
|
||||
self._client.get(index=self._collection_name.lower(), id=id)
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
@override
|
||||
|
||||
@ -20,7 +20,7 @@ class QuotaCharge:
|
||||
try:
|
||||
do_work()
|
||||
charge.commit() # Confirm consumption
|
||||
except:
|
||||
except Exception:
|
||||
charge.refund() # Release frozen quota
|
||||
|
||||
If neither commit() nor refund() is called, the billing system's
|
||||
|
||||
@ -881,7 +881,7 @@ class WebhookService:
|
||||
response_data = {"message": response_body}
|
||||
else:
|
||||
response_data = {"status": "success", "message": "Webhook processed successfully"}
|
||||
except:
|
||||
except Exception:
|
||||
response_data = {"message": response_body or "Webhook processed successfully"}
|
||||
|
||||
return response_data, status_code
|
||||
|
||||
Loading…
Reference in New Issue
Block a user