MCPcopy
hub / github.com/prisma/prisma / emitStepFailed

Function emitStepFailed

packages/cli/src/bootstrap/telemetry.ts:62–74  ·  view source on GitHub ↗
(ctx: TelemetryContext, stepName: string, error: string)

Source from the content-addressed store, hash-verified

60}
61
62export 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
76function extractErrorClass(msg: string): string {
77 const prismaCode = msg.match(/P\d{4}/)?.[0]

Callers 3

runMethod · 0.90
scaffoldTemplateMethod · 0.90
runInitMethod · 0.90

Calls 4

isTelemetryDisabledFunction · 0.85
extractErrorClassFunction · 0.85
basePropertiesFunction · 0.85
captureMethod · 0.65

Tested by

no test coverage detected