Do not throw errors but report diagnostic #1508
Labels
design-discussion
An area of design currently under discussion and open to team and community feedback.
Milestone
Emitters should report errors as many as possible therefore if possible, emitters should not crash on purpose (for example throw new Error).
Throwing an error will cause the emitter to crash, and when the emitter crashes, typespec compiler will flag this as a bug in the emitter and recommend the user to open an issue for it.
For those unexpected, it is fine that the emitter would crash, because it is "unexpected", we could never prevent it therefore it should be categorized as a bug.
Ensure do not throw Error unless we really want the emitter to crash, otherwise we should report error diagnostic.
The text was updated successfully, but these errors were encountered: