diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-07-10 11:05:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-10 11:05:14 -0700 |
commit | 5ccfbacb8914bd220d67c95f9e9310c872eb987f (patch) | |
tree | 6f6cd08a86c0aae85bd1838b1f465822063b2598 /src/js/binaryen.js-post.js | |
parent | 14ea9995281718b9694db4ed5441d44d1171e86f (diff) | |
download | binaryen-5ccfbacb8914bd220d67c95f9e9310c872eb987f.tar.gz binaryen-5ccfbacb8914bd220d67c95f9e9310c872eb987f.tar.bz2 binaryen-5ccfbacb8914bd220d67c95f9e9310c872eb987f.zip |
Proper error handling in add* and get* methods (#1570)
See #1479 (comment)
Also a one-line readme update, remove an obsolete compiler (mir2wasm) and add a new one (asterius).
Also improve warning and error reporting in binaryen.js - show a stack trace when relevant (instead of node.js process.exit), and avoid atexit warning spam in debug builds.
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r-- | src/js/binaryen.js-post.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index 6e4833986..b61b8c3e2 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -1609,3 +1609,12 @@ Module['setDebugInfo'] = function(on) { Module['setAPITracing'] = function(on) { return Module['_BinaryenSetAPITracing'](on); }; + +// Additional customizations + +Module['exit'] = function(status) { + // Instead of exiting silently on errors, always show an error with + // a stack trace, for debuggability. + if (status != 0) throw new Error('exiting due to error: ' + status); +}; + |