diff --git a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts index 438f918d5f..c8936f8032 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Options.ts @@ -138,11 +138,6 @@ export type LoggerEvent = fnLoc: t.SourceLocation | null; fnName: string | null; memoSlots: number; - } - | { - kind: "PipelineError"; - fnLoc: t.SourceLocation | null; - data: any; }; export type Logger = { diff --git a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts index 991f44b70a..ac03d0183d 100644 --- a/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts +++ b/compiler/packages/babel-plugin-react-forget/src/Entrypoint/Program.ts @@ -68,29 +68,14 @@ type CompileResult = { function handleError( pass: CompilerPass, fnLoc: t.SourceLocation | null, - err: unknown + err: CompilerError ): void { if (pass.opts.logger) { - if (err instanceof CompilerError) { - for (const detail of err.details) { - pass.opts.logger.logEvent(pass.filename, { - kind: "CompileError", - fnLoc, - detail: detail.options, - }); - } - } else { - let stringifiedError; - if (err instanceof Error) { - stringifiedError = err.stack ?? err.message; - } else { - stringifiedError = err?.toString() ?? "[ null ]"; - } - + for (const detail of err.details) { pass.opts.logger.logEvent(pass.filename, { - kind: "PipelineError", + kind: "CompileError", fnLoc, - data: stringifiedError, + detail: detail.options, }); } }