Try the example bellow running on node.js or in a browser:
binaryen.parseText(`(module
(func (export "foo") (param $a i32) local.get $a)
(func (export "bar") (paXam $b i32) local.get $b)
)`)
They will both log: Fatal: 3:24: error: unrecognized instruction
However a try/catch will only get the error Program terminated with exit(1)
An ugly hack replacing console.error() won't catch on the useful message either.
Can this method just throw the first (real) error, or add that on the cause of the catchable error?