aurelia / framework

The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
MIT License
11.75k stars 623 forks source link

better error logging #926

Open MikeKovarik opened 5 years ago

MikeKovarik commented 5 years ago

I'm submitting a feature request

Current behavior: If you make a typo, or on this case I forgot to add async to a function, you get a long but useless stacktrace pointing to inside of aurelia but nowhere in the stack trace does it give me any clue of what view, class, file is at fault. I've had this issue for years, ever since Aurelia was still in beta and it's been my biggest problem with aurelia ever since. Because despite having .developmentLogging() enabled I'm subjected to tearing my app down and uncommenting it line by line until I find the needle in the haystack

image

Expected Behavior: Some general information about origin of the error - the file, line, or a class/method

bigopon commented 5 years ago

@MikeKovarik thanks for filing this.

The error you got is SyntaxError, so first thing to do would have been looking for ... syntax error. The reason why it got so long stack is because that module is loaded by Aurelia Router, via dynamic import() api, as I see you are using aurelia-script there. That said, there's thing we can improve in the router, such as checking error, if it's SyntaxError, log a message to give some hint how to debug it, before rethrowing it, if it makes sense.

cc @EisenbergEffect