question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Improved error messages and handling

See original GitHub issue

tldr; put some effort into improving our error messaging across the board in DoneJS, but especially in StealJS and done-ssr.

This was discussed on a recent live stream (30:19).

The Problem

live-reload is a fantastic tool for helping with rapid development of application. But if your app gets into an awkward state, like when you have a syntax error, it can be difficult to understand what the problem is and figure out how to fix it.

The Solution

We would like to put some effort into improving our error messaging. Some inspiration comes from other frameworks, such as create-react-app which gives errors like:

687474703a2f2f692e696d6775722e636f6d2f466e4c566677362e706e67

When there is a syntax error.

Elm gives good error messages when there is a compilation error:

incomplete

What if we could produce error messages that specifically showed bad code. Imagine code like:

let map = new DefineMap();

map.set('bar');

What if we could display an error message (in the console? Maybe in the browser some how too?) that was:

Missing required argument.

2|> let map = new DefineMap();
3|>
4|> map.set('bar');

`set` expects to be passed 2 arguments.

This would be quite useful as it would give a dynamic language like JavaScript some of (but not all of course) the benefits of static languages by pointing out mistakes.

Tasks

We can’t just jump to implementation as we really need to get a good handle on what users are actually facing. I think the steps would be:

  1. Spend a few days just trying to break DoneJS in as many ways as possible, documenting what was done and what the result is (a screenshot if possible).
  2. Spend a few more days doing some analysis of other tools and how they handle these types of mistakes.
  3. Build a system so that we can gather more detailed information on errors.
  4. Design how we will display these errors. Should it be done in the console? Or specially handled in each environment (maybe an overlay in the browser and special formatting in the terminal?). Research in (2) will inform our choices here.
  5. Implement and show off!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
justinbmeyercommented, Feb 27, 2018

Another stealjs one that I’m not sure is already reported, what happens if package.json isn’t valid, is missing a main, etc.

0reactions
matthewpcommented, Mar 5, 2018
Scenario Server response Problems Issues
Error starting done-serve The error message
Error starting done-serve, then it is fixed. Should render Fixing itself is hard because file-watching is based on getting the graph of the project, which we cannot do if there is a load error.
done-serve starts, then an error occurs on a file change The error message
done-serve starts, then an error, then it is fixed Should render
Read more comments on GitHub >

github_iconTop Results From Across the Web

proposal: Go 2: Error handling that is compact and composeable
Existing proposals to improve Go errors taught us that our solution must provide 2 things: the insertion of a return statement for errors. ......
Read more >
Laurence Tratt: A Proposal for Error Handling
There are two main approaches to trapping and propagating errors which, to avoid possible ambiguity, I define as follows: Error checking is ...
Read more >
Error Handling — Draft Design
There have been many proposals over time to improve error handling in Go. For instance, see: golang.org/issue/21161: simplify error handling ...
Read more >
Improved Error Handling in DoneJS - Bitovi
Code snippets in error messages that show where the problem occured. Links to documentation explaining each error in greater detail. This video ...
Read more >
Thoughts on the "Guard" Proposal for Go's Error Handling
I found this proposal for improvements to error handling in Go interesting, but still not something I'd be happy to see implemented.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found