DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.36k stars 29 forks source link

Better require error messages in comptime #1214

Closed edemaine closed 5 months ago

edemaine commented 5 months ago

By the way, I'm thinking throws should allow for specifying and checking what error message we get. What do you think would be the ideal format (presumably something after ---)? Perhaps the exact contents of error.toString(), which seems to be of the form type: message. Alternatively, we might need regexes in some contexts, if the error message varies, but I can't think of a setting where that's the case.

STRd6 commented 5 months ago

Adding an optional exact error message to match to throws sounds good, something like:

throws ```
test name
---
...
---
exact error message


And allow omitting the final `---` to accept any error message.