Skip to content

Commit 0b87aff

Browse files
Merge pull request #578 from ruby/katei/diagnose-potential-fix
2 parents aa7483e + a1dd6b9 commit 0b87aff

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/vm.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ export class RubyVM {
132132
vm.addToImports(imports);
133133
options.addToImports?.(imports);
134134
const instance = await WebAssembly.instantiate(module, imports);
135-
await vm.setInstance(instance);
135+
try {
136+
await vm.setInstance(instance);
137+
} catch (e) {
138+
console.error("Failed to instantiate Ruby VM. Please make sure that you have added `gem \"js\"` to your Gemfile.");
139+
throw e;
140+
}
136141
options.setMemory?.(instance.exports.memory as WebAssembly.Memory);
137142
wasip1.initialize(instance);
138143
vm.initialize(options.args);

0 commit comments

Comments
 (0)