Open jerinphilip opened 2 years ago
This happens because assert()
is defined by bergamot-translation-worker.js, the Emscripten runtime code:
function assert(condition, text) {
if (!condition) {
abort(text);
}
}
// ...
function abort(what) {
what = "Aborted(" + what + ")";
err(what);
ABORT = true;
EXITSTATUS = 1;
what += ". Build with -s ASSERTIONS=1 for more info.";
var e = new WebAssembly.RuntimeError(what);
throw e;
}
You could replace assert()
with console.assert()
which is the more common API for it in Javascript. Downside: console.assert
just prints a message but does not stop the program from continuing. So it isn't really equivalent.
I'm trying to get an
assert
working for #425; Despite no issues in WebAssembly, the following error message is dumped:The following is the relevant source: