In JS, you can set an error handler for a whole module, to catch all otherwise-uncaught errors. We could use this to serialize those errors (complete with traceback) into the logging system.
This would allow more complete logs and/or better code (no need to throw and log).