fix(core): improve error type extraction for telemetry (#19565)

Co-authored-by: Yuna Seol <yunaseol@google.com>
This commit is contained in:
Yuna Seol
2026-02-19 16:19:19 -05:00
committed by GitHub
parent ddc5458451
commit 8064973899
4 changed files with 74 additions and 1 deletions
+9
View File
@@ -26,6 +26,15 @@ export function getErrorMessage(error: unknown): string {
}
}
export function getErrorType(error: unknown): string {
if (!(error instanceof Error)) return 'unknown';
// Return constructor name if the generic 'Error' name is used (for custom errors)
return error.name === 'Error'
? (error.constructor?.name ?? 'Error')
: error.name;
}
export class FatalError extends Error {
constructor(
message: string,