Skip to main content

classify_tool_error

Function classify_tool_error 

Source
pub fn classify_tool_error(error: &(dyn Error + 'static)) -> String
Expand description

Classify a tool execution error into a telemetry-safe string.

In minified/external builds, error.constructor.name is mangled into short identifiers like “nJT” or “Chq” — useless for diagnostics. This function extracts structured, telemetry-safe information instead:

  • TelemetrySafeError: use its telemetryMessage (already vetted)
  • Node.js fs errors: log the error code (ENOENT, EACCES, etc.)
  • Known error types: use their unminified name
  • Fallback: “Error” (better than a mangled 3-char identifier)