Skip to content
This repository has been archived by the owner on Apr 8, 2020. It is now read-only.

Inaccurate errors returned by compiler #448

Closed
piotrek-k opened this issue Nov 19, 2016 · 7 comments
Closed

Inaccurate errors returned by compiler #448

piotrek-k opened this issue Nov 19, 2016 · 7 comments

Comments

@piotrek-k
Copy link

I'm currently building an Angular app using template from your yeoman generator. There is one thing that annoys me and I think it should be fixed.

This is how "Internal Server Errors" are being shown in my project:
internal server error - mozilla firefox 2016-11-19 21 52 40
Information I've received is highly inaccurate. Message tells me that there is some unexpected token somewhere in my code and in files like http.umd.js, main-server.js or \rxjs\Subscriber.js which is not true, because problem happens in my code, not in components I import.

Is there any way I could improve quality of error messages I receive? I mean: is it possible to include in such error message exact position of faulty code? Or at least name of file where it happens?

Additional info:
Type of generated project: Angular2
Used dependencies: "Microsoft.AspNetCore.SpaServices": "1.0.0-beta-000019"

@MarkPieszak
Copy link
Contributor

Unfortunately that error comes from Angular, which was bubbled up through Node (during the server rendering process) and then showed up here. What changes did you make for this to happen? My guess is a component is either out in correctly, or maybe you imported something? Any changes from the base would help.

But you're right, the message is too vague, I can try to bring it up to some folks to see if there's anyway angular can help more with that one!

@SteveSandersonMS
Copy link
Member

Yep, sorry @piotrek-k, but as @MarkPieszak mentions that's all the information Angular 2 returns in this case.

If you want to improve this, could I suggest following up in the Angular issues list?

@piotrek-k
Copy link
Author

@SteveSandersonMS I don't think that is Angular issue. As far as I know Angular returns detailed errors in browser console. When I was following angular.io tutorial, browser was returning proper stack trace with exact position of problem. This have to be something with Node.js server side compiler.
How do you use this template in serious projects then, if you have to guess what's wrong if something goes wrong? You're using webpack and it's automatic js compiling to save time and you're wasting it on interpreting error messages ;)

@MarkPieszak
Copy link
Contributor

Do you know what it was exactly that caused it? Some template issue, an incorrect import statement? Let me know so we can try to repro it, and at the very least I can see if it's possible to capture some of the vaguer messages and send something better!

Angular has fairly detailed messages, but in this case we are server rendering it, so a myriad of things can go wrong during that parsing and serializing process, some errors which don't come from Core itself, this is why it's so tough !

Any help knowing what line causes it would help though. Thanks Piotrek

@SteveSandersonMS
Copy link
Member

Agreed with @MarkPieszak's comments.

@piotrek-k Is this same error definitely reported better when it happens on the client, vs on the server? If so, I'm sure the Angular Universal (component that handles the server-side rendering) folks would want to look at that!

@piotrek-k
Copy link
Author

Is there a quick way to temporarily disable prerendering for my website? To see how it behaves? How can I check those client errors?

BTW: error I was talking about magically disappeared after I came back to coding this website, but I would like to know what to do, if I will see something similar in the future ;)

@MarkPieszak
Copy link
Contributor

Just remove the asp-prerender-module tag from your Views/Home/Index.cshtml and that will disable SSR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants