Skip to content

Creating custom code frame from thrown error #5081

Answered by mischnic
Aaronius asked this question in General
Discussion options

You must be logged in to vote

The primary reason is that, aside from Parcel, we have a few other actors in our system that can generate errors based on code (babel's parser being one of them, Terser being another). These errors are displayed to users of our build system and we want to produce consistent-looking messages and code frames (as close as possible) to present to users of our build system.

That is actually why we did our own codeframe as well, to normalize Babel's and Terser's codeframe format into one 😉

This puts the burden on me, the Parcel consumer, to basically duplicate this code ^^^ in my own code. It would make my life simpler if I could rely on error.diagnostics.*.codeFrame.code always existing. Is…

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@Aaronius
Comment options

@mischnic
Comment options

@Aaronius
Comment options

@Aaronius
Comment options

@mischnic
Comment options

mischnic Sep 4, 2020
Collaborator

Answer selected by Aaronius
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants