Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add codes and URLs to errors/warnings #474

Closed
Rich-Harris opened this issue Apr 12, 2017 · 4 comments · Fixed by #1340
Closed

Add codes and URLs to errors/warnings #474

Rich-Harris opened this issue Apr 12, 2017 · 4 comments · Fixed by #1340

Comments

@Rich-Harris
Copy link
Member

Post-#473, it might be a nice idea to add codes and URLs to error and warnings objects generated during compilation. That way, custom handlers could easily filter out warnings, and we could print troubleshooting URLs for things that require more explanation than can fit in an error message.

@ghost
Copy link

ghost commented Apr 13, 2017

You could consider using fransciscop/human-error to make errors more Elm-like.

@Rich-Harris
Copy link
Member Author

Oh cool, I wasn't aware of human-error. Looks great. I've been very inspired by Elm's approach to error message, hence this sort of thing:

screen shot 2017-04-13 at 10 24 16 am

screen shot 2017-04-13 at 10 26 47 am

screen shot 2017-04-13 at 10 28 52 am

One of the great things about doing more of the work at compile time is you can really go to town on trying to figure out what the user meant by using string distance algorithms and AST traversal etc — stuff that would be considered extravagant at runtime even behind a dev: true flag.

I'd thought about having a troubleshooting page on the guide that error messages could link to (Rollup does this, errors and warnings will frequently point you towards sections on the wiki), but now that you point it out there's really no good reason not to put extensive documentation right there with the error message.

Maybe a URL is still more appropriate for warnings, since they're not necessarily blockers and you might want to carry on working without your terminal being overtaken with documentation.

@ghost
Copy link

ghost commented Apr 13, 2017

Wonderfully done with the error messages — had yet to stumble upon them. :)

And yes, URLs are indeed more appropriate for warnings.

@PaulBGD
Copy link
Member

PaulBGD commented Jul 11, 2017

As a compiler I think providing error/warning messages in the outputted code for dev mode is the way to go. URLs require an internet connection and an extra step in figuring out what went wrong. Plus, if there's a warning there's also probably something to fix.

@Rich-Harris Rich-Harris mentioned this issue Apr 14, 2018
Rich-Harris added a commit that referenced this issue Apr 15, 2018
Rich-Harris added a commit that referenced this issue Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants