MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / classifyAgentError

Function classifyAgentError

server-source-code/internal/handler/rdp.go:391–406  ·  view source on GitHub ↗

classifyAgentError maps the agent's free-text error into a stable code the frontend can switch on to render specific guidance. The message itself is still shown verbatim; the code just tells the UI which help block to pick.

(msg string)

Source from the content-addressed store, hash-verified

389// frontend can switch on to render specific guidance. The message itself is
390// still shown verbatim; the code just tells the UI which help block to pick.
391func classifyAgentError(msg string) string {
392 lower := strings.ToLower(msg)
393 switch {
394 case strings.Contains(lower, "rdp-proxy-enabled"), strings.Contains(lower, "rdp proxy is not enabled"):
395 return "agent_rdp_disabled"
396 case strings.Contains(lower, "invalid host"):
397 return "agent_invalid_host"
398 case strings.Contains(lower, "connection refused"),
399 strings.Contains(lower, "failed to connect"),
400 strings.Contains(lower, "i/o timeout"),
401 strings.Contains(lower, "no route to host"):
402 return "rdp_port_unreachable"
403 default:
404 return "agent_error"
405 }
406}
407
408// WebsocketTunnelHandler returns an http.Handler for the Guacamole WebSocket tunnel.
409// It wraps the guac WebSocket server with origin validation to prevent cross-origin hijacking.

Callers 1

ServeCreateTicketMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected