You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the Parcel API and an error is thrown, there's no guarantee that error.diagnostics.*.codeFrame.code exists. If it doesn't then the consumer of the API has to duplicate this logic to retrieve the code pertaining to the code frame:
This is kind of a pain. I would love to see Parcel normalize these errors so that when a consumer receives a code frame on an error, the code property always exists and the consumer doesn't have to bother with reading source files directly.
🤔 Expected Behavior
I would expect the code property to always exists on any code frame being reported by Parcel.
😯 Current Behavior
The code property only sometimes exists on a code frame.
💁 Possible Solution
If a plugin doesn't provide the code property, Parcel could add it before the error makes its way to the Parcel consumer.
🙋 feature request
When using the Parcel API and an error is thrown, there's no guarantee that
error.diagnostics.*.codeFrame.code
exists. If it doesn't then the consumer of the API has to duplicate this logic to retrieve the code pertaining to the code frame:parcel/packages/core/utils/src/prettyDiagnostic.js
Lines 52 to 55 in c4e494f
This is kind of a pain. I would love to see Parcel normalize these errors so that when a consumer receives a code frame on an error, the
code
property always exists and the consumer doesn't have to bother with reading source files directly.🤔 Expected Behavior
I would expect the
code
property to always exists on any code frame being reported by Parcel.😯 Current Behavior
The
code
property only sometimes exists on a code frame.💁 Possible Solution
If a plugin doesn't provide the
code
property, Parcel could add it before the error makes its way to the Parcel consumer.🔦 Context
This is described in further detail in #5081.
💻 Examples
The text was updated successfully, but these errors were encountered: