breuleux/earl-grey

non-descriptive error for string interpolation

Closed this issue · 1 comments

This comes right from the REPL:

''
E.syntax.failure
The macro expected something different (could not locate error in the source).

The problem is - it is very hard to locate such mistakes in a project with multiple modules. It doesn't say what macro fails, doesn't say where. I spend a lot of time writing CoffeeScript and as a result I do a lot of such mistakes because of the reversed syntax :-)

I never realized '' was an error, that's embarrassing. I really need to work on test coverage. Anyway, I fixed it on master.

Yeah, the error message is misleading, especially since it does usually tell you approximately where it happens (it highlights '' with line/column, doesn't it?) For the most part this error indicates a failure on the macro implementer's side (me), not on your side: either a failure in the implementation, or a failure to provide an informative error message. It's a fallback/last resort error message basically.

I've pushed some improvements to the default error messages. The error message you came upon would now look like this, which I think is better:

E.syntax.failure: An error occurred in the `'` macro. You should bug the macro/language implementer to fix this.