Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error messages for tagged template function Syntax Errors. #248

Open
brainkim opened this issue Feb 23, 2023 · 0 comments
Open

Better error messages for tagged template function Syntax Errors. #248

brainkim opened this issue Feb 23, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@brainkim
Copy link
Member

brainkim commented Feb 23, 2023

The 0.5 template tag needs better error messages.

jsx`
  <a
    href=${doc.url}
    aria-current=${doc.url === url && "page"}
    class=${css`
      text-decoration: none;
    `}
    "
  >${doc.attributes.title}</a>
`

Throws

file:///Users/briankim/Projects/crank/src/jsx-tag.ts:248
                                                        throw new SyntaxError(
             ^
SyntaxError: Unexpected text `"`

These messages could be nicer. Like how Babel and TypeScript do it. Something that shows the error in context of the line. Maybe we could use a SyntaxError subclass like JSXSyntaxError to make things even clearer.

@brainkim brainkim added the enhancement New feature or request label Feb 27, 2023
@brainkim brainkim added this to the 0.6 milestone Dec 31, 2023
@brainkim brainkim removed this from the 0.6 milestone Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant