js: make sure to report exceptions thrown during parsing