(ctx: TelemetryContext, stepName: string, error: string)
| 60 | } |
| 61 | |
| 62 | export async function emitStepFailed(ctx: TelemetryContext, stepName: string, error: string): Promise<void> { |
| 63 | if (isTelemetryDisabled()) return |
| 64 | try { |
| 65 | const errorCode = error.match(/^[A-Z]\d+:|Error code: ([A-Z]\d+)/)?.[1] ?? extractErrorClass(error) |
| 66 | await eventCapture.capture(ctx.distinctId, 'activation:cli_step_failed', { |
| 67 | ...baseProperties(ctx), |
| 68 | step_name: stepName, |
| 69 | error_code: errorCode, |
| 70 | }) |
| 71 | } catch { |
| 72 | // telemetry should never block the command |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function extractErrorClass(msg: string): string { |
| 77 | const prismaCode = msg.match(/P\d{4}/)?.[0] |
no test coverage detected