summaryrefslogtreecommitdiff
path: root/src/js/binaryen.js-post.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/binaryen.js-post.js')
-rw-r--r--src/js/binaryen.js-post.js9
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);
+};
+