Skip to content

Commit bd9532a

Browse files
Report VM dump whenever non-RbError caught
1 parent 74de0dc commit bd9532a

File tree

1 file changed

+6
-1
lines changed
  • packages/npm-packages/ruby-wasm-wasi/src

1 file changed

+6
-1
lines changed

packages/npm-packages/ruby-wasm-wasi/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,13 @@ function wrapRbOperation<R>(vm: RubyVM, body: () => R): R {
513513
try {
514514
return body();
515515
} catch (e) {
516+
if (e instanceof RbError) {
517+
throw e;
518+
}
519+
// All JS exceptions triggered by Ruby code are translated to Ruby exceptions,
520+
// so non-RbError exceptions are unexpected.
521+
vm.guest.rbVmBugreport();
516522
if (e instanceof WebAssembly.RuntimeError && e.message === "unreachable") {
517-
vm.guest.rbVmBugreport();
518523
const error = new RbError(`Something went wrong in Ruby VM: ${e}`);
519524
error.stack = e.stack;
520525
throw error;

0 commit comments

Comments
 (0)