I just took a peek at the node.js Errors class. In order to keep things simple, I would make the error parameter just a string with an error message and in other places where there is an err parameter the same with the continued convention that err==null => no error. I believe this is simple, reasonably compatible with node.js, and compatible with what Espruino has now.
One thing I noticed is that where an on.('error', function... event is used the node.js docs state explicitly that if no error handler is registered a (fatal) exception is thrown. I believe we should do that too, because right now, I think that code that doesn't use an error handler will just hang on error.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I just took a peek at the node.js Errors class. In order to keep things simple, I would make the error parameter just a string with an error message and in other places where there is an err parameter the same with the continued convention that
err==null
=> no error. I believe this is simple, reasonably compatible with node.js, and compatible with what Espruino has now.One thing I noticed is that where an
on.('error', function...
event is used the node.js docs state explicitly that if no error handler is registered a (fatal) exception is thrown. I believe we should do that too, because right now, I think that code that doesn't use an error handler will just hang on error.