Skip to content

codehag/js-better-errors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Better Errors in JS

undefined is not a function

Error messages in JavaScript leave a bit to be desired. So let's make them better! If you have encountered an error that could have been better with a bit more context, please open an issue!

How to collect error messages

Any way you run JS can be a good way to get an error message: in a web browser, in Node.js, etc. Errors that you file issues on should be reduced to a minimal test case (ideally just a couple lines when possible). To file an issue, you should understand what went wrong in the program, and what JS is trying to tell you went wrong (even if the message itself doesn't indicate things clearly).

You can use eshost and jsvu to run a JS code snippet across many JS engines. These projects make it easy to run a snippet across several engines. Sometimes, one of them will have a good message, which could be used as a model for the others.

Purpose

Error messages in JavaScript have improved somewhat over time, but they can still be confusing to developers of all experience levels. Many of the people who work on the JS engines themselves want to help, but it's unclear where to start: What errors are commonly hit by JS developers? What would be a clear description of what's going on, from a JS dev perspective?

The goal of this project is to be a resource to JS engine developers, providing them with a ready-made wishlist of error conditions and messages, so that they can focus on on the implementation.

Which errors?

This project is focused on error messages from the JS engine itself. These messages are all of the six native error types in the JS standard: EvalError, RangeError, ReferenceError, TypeError, URIError, SyntaxError. (Other error types are generated by other pieces of software, so if you file an issue about them, it's less likely to get through to the right people who can fix it.)

About

Let's discuss making better errors for JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published