You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get an assert working for #425; Despite no issues in WebAssembly, the following error message is dumped:
Using fallback gemm implementation
<p>Hallo Welt!</p> <p>Wiedersehen Welt!</p>
string
DocumentFragment {}
<p>Hallo Welt!</p>
Aborted(undefined)
undefined:448
var e = new WebAssembly.RuntimeError(what);
^
RuntimeError: Aborted(undefined). Build with -s ASSERTIONS=1 for more info.
at abort (eval at <anonymous> (/home/jerin/code/bergamot-translator/build-wasm/node-test.js:1:1), <anonymous>:448:10)
at assert (eval at <anonymous> (/home/jerin/code/bergamot-translator/build-wasm/node-test.js:1:1), <anonymous>:116:3)
at Object.onRuntimeInitialized (/home/jerin/code/bergamot-translator/build-wasm/node-test.js:112:3)
This happens because assert() is defined by bergamot-translation-worker.js, the Emscripten runtime code:
functionassert(condition,text){if(!condition){abort(text);}}// ...functionabort(what){what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -s ASSERTIONS=1 for more info.";vare=newWebAssembly.RuntimeError(what);throwe;}
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.
* Expand the node-test.js example code with documentation
Is there a better way to document code than by providing an annotated & working example of it? Just listing all the exposed methods feels like giving people a box of bricks and expecting them to build a house with it.
* Use @jerin's feedback to simplify node-test.js explanations
* Use native `console.assert` instead
See #426 for an explanation
* Fix comment
Co-authored-by: Nikolay Bogoychev <[email protected]>
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:
The text was updated successfully, but these errors were encountered: