Skip to content

Confusing error message from WebAssembly + JS #426

@jerinphilip

Description

@jerinphilip

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)

The following is the relevant source:

  ...
  // Construct std::vector<std::string> inputs;
  const input = new Module.VectorString();
  input.push_back('<p> Hello world! </p> <p> Goodbye World! </p>');

  // Construct std::vector<ResponseOptions>
  const options = new Module.VectorResponseOptions();
  options.push_back({qualityScores: false, alignment: true, html: true});

  // Translate our batch (of 1)
  const output = service.translate(model, input, options);

  // Get output from std::vector<Response>
  const translation = output.get(0).getTranslatedText()
  console.log(translation)
  console.log(typeof (translation));

  const fragment = JSDOM.fragment(translation)
  console.log(fragment)
  console.log(fragment.firstElementChild.outerHTML)
  assert(fragment.childElementCount === 1); // This fails, because 2, and has nothing to do with WebAssembly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions