Files
orca/src/shared/errno-code.ts
T
faf173235b fix(telemetry): send an errno code, not the raw message, in agent_hook_install_failed (#25287)
agent_hook_install_failed sent up to 200 chars of the raw installer error,
which embeds home-directory paths (and so the OS user name) and can echo
config contents. Send only the error's errno code or 'unknown', and enforce
that in the event schema. The anchored, capped errno pattern now lives in
src/shared/errno-code.ts and is shared with the renderer launch probe and the
file-write precondition instead of their own copies.

Fixes #21492

Co-authored-by: brynnclaw <261708852+brynnclaw@users.noreply.github.com>
Co-authored-by: Neil <neil@stably.ai>
2026-10-26 03:39:17 -07:00

8 lines
399 B
TypeScript

// Node/libuv errno codes (`EACCES`, `E2BIG`); anchored and capped so a code can't carry a path.
export const ERRNO_CODE_PATTERN = /^E[A-Z0-9]{1,15}$/
export function errnoCodeOrUnknown(error: unknown): string {
const code = typeof error === 'object' && error !== null && 'code' in error ? error.code : null
return typeof code === 'string' && ERRNO_CODE_PATTERN.test(code) ? code : 'unknown'
}