Skip to content

fix: throw Error instead of raw array for TypeScript compilation fail…#162

Open
nikhiltelkar2005-glitch wants to merge 1 commit into
accordproject:mainfrom
nikhiltelkar2005-glitch:fix/compiler-error-format
Open

fix: throw Error instead of raw array for TypeScript compilation fail…#162
nikhiltelkar2005-glitch wants to merge 1 commit into
accordproject:mainfrom
nikhiltelkar2005-glitch:fix/compiler-error-format

Conversation

@nikhiltelkar2005-glitch

Copy link
Copy Markdown

Description

This PR fixes an issue in TemplateMarkToJavaScriptCompiler.compile() where a raw Array<CompilerError> was being thrown instead of a standard Error object when a template formula contained invalid TypeScript.

Previously, any caller catching this compilation failure would receive [object Object] without a .message property or a stack trace, making the rich error information (collected by twoslash) completely inaccessible.

Changes Made

  • Wrapped the compilation errors array in a standard Error object.
  • Formatted the error .message to be human-readable, exposing the exact:
    • Node ID
    • Error description (rendered message)
    • Line number
    • Column number (character)

Related Issues

Fixes #128

(Note: TemplateArchiveProcessor has a similar issue where result.errors is not checked after compilation, which will be addressed in a follow-up issue).

@nikhiltelkar2005-glitch nikhiltelkar2005-glitch requested a review from a team June 10, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant