feat(api): Implement EventManager error logging and add coverage (#29204)

- Ensure `EventManager._notify_layers` logs exceptions instead of silently swallowing them 
  so GraphEngine layer failures surface for debugging
- Introduce unit tests to assert the logger captures the runtime error when collecting events
- Enable the `S110` lint rule to catch `try-except-pass` patterns
- Add proper error logging for existing `try-except-pass` blocks.
This commit is contained in:
QuantumGhost
2025-12-08 09:40:40 +08:00
committed by GitHub
parent a25faa334a
commit 91667e3c1d
15 changed files with 103 additions and 33 deletions

View File

@@ -1,9 +1,13 @@
import logging
from core.tools.tool_manager import ToolManager
from core.tools.utils.configuration import ToolParameterConfigurationManager
from core.workflow.nodes import NodeType
from core.workflow.nodes.tool.entities import ToolEntity
from events.app_event import app_draft_workflow_was_synced
logger = logging.getLogger(__name__)
@app_draft_workflow_was_synced.connect
def handle(sender, **kwargs):
@@ -30,6 +34,10 @@ def handle(sender, **kwargs):
identity_id=f"WORKFLOW.{app.id}.{node_data.get('id')}",
)
manager.delete_tool_parameters_cache()
except:
except Exception:
# tool dose not exist
pass
logger.exception(
"Failed to delete tool parameters cache for workflow %s node %s",
app.id,
node_data.get("id"),
)