fix(registry): preserve full traceback on tool dispatch errors

logger.error() only records the exception message string, silently
discarding the stack trace. Switch to logger.exception() which
automatically appends the full traceback to the log output.

Without this change, when a tool handler raises an unexpected error
the log shows only the exception type and message, making it
impossible to determine which line caused the failure or trace
through nested calls.
This commit is contained in:
BathreeNode 2026-03-02 11:57:47 +03:00 committed by GitHub
parent e265006fd6
commit d2ec5aaacf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -125,7 +125,7 @@ class ToolRegistry:
return _run_async(entry.handler(args, **kwargs)) return _run_async(entry.handler(args, **kwargs))
return entry.handler(args, **kwargs) return entry.handler(args, **kwargs)
except Exception as e: except Exception as e:
logger.error("Tool %s dispatch error: %s", name, e) logger.exception("Tool %s dispatch error: %s", name, e)
return json.dumps({"error": f"Tool execution failed: {type(e).__name__}: {e}"}) return json.dumps({"error": f"Tool execution failed: {type(e).__name__}: {e}"})
# ------------------------------------------------------------------ # ------------------------------------------------------------------