glimmer-vm icon indicating copy to clipboard operation
glimmer-vm copied to clipboard

Include file name and source locations in template compiler errors

Open sclaxton opened this issue 7 years ago • 6 comments

When throwing errors such as this we should at the very least include the hbs file name and source location of the error. Debugging this sort of error is pretty hellish when you've changed a lot of template code. It seems like the compiler is already set up to include source location in the meta of an opcode statement, it's just hard-coded to be switched off. Would be happy to starting working on this if people have any guidance on implementation!

sclaxton avatar Jan 30 '18 23:01 sclaxton

@sclaxton IMO this is one of the highest-priority things we can work on. We've built a programming language and runtime, we should report errors as such. I know there was a branch that was working on this that went stale. I will try to track down who was working on that and see if it might be useful for you to get an idea of the implementation strategy.

We already have source information propagated through the AST, so it should "just" be a matter of propagating that information down to generated opcodes in development mode.

tomdale avatar Jan 31 '18 16:01 tomdale

Thanks @tomdale! That stale branch would be super helpful just to get an idea since I'm new to the code.

Related: I also saw that @wycats opened #418 a while ago. Moving to a "reporter" structure could be a follow-up to this change. I would love to start a quest-style effort to make glimmer's error reporting super robust.

sclaxton avatar Jan 31 '18 19:01 sclaxton

@sclaxton and @tomdale if you're interested in working on this, I'd be happy to put together a quest for this problem and help work through the needed steps.

wycats avatar Feb 05 '18 04:02 wycats

@wycats I am interested! I would also really appreciate the help getting started on the quest :)

sclaxton avatar Feb 06 '18 18:02 sclaxton

@wycats @sclaxton did you two ever sync up? this still seems like a very valuable thing to do :)

Turbo87 avatar Feb 28 '20 11:02 Turbo87

I'm definitely still interested :) A co-worker was just telling me yesterday how he wished template errors had better reporting, so this is very much still a relevant problem for me. Totally forgot I had opened this issue...

sclaxton avatar Feb 28 '20 21:02 sclaxton