File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/npm-packages/ruby-wasm-wasi/src Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -137,8 +137,7 @@ export class RubyVM {
137
137
const str = new TextDecoder ( ) . decode (
138
138
new Uint8Array ( memory . buffer , messagePtr , messageLen ) ,
139
139
) ;
140
- throw new RbFatalError (
141
- "Ruby APIs that may rewind the VM stack are prohibited under nested VM operation " +
140
+ let message = "Ruby APIs that may rewind the VM stack are prohibited under nested VM operation " +
142
141
`(${ str } )\n` +
143
142
"Nested VM operation means that the call stack has sandwitched JS frames like JS -> Ruby -> JS -> Ruby " +
144
143
"caused by something like `window.rubyVM.eval(\"JS.global[:rubyVM].eval('Fiber.yield')\")`\n" +
@@ -148,8 +147,13 @@ export class RubyVM {
148
147
" Note that `evalAsync` JS API switches fibers internally\n" +
149
148
" 2. Raising uncaught exceptions\n" +
150
149
" Please catch all exceptions inside the nested operation\n" +
151
- " 3. Calling Continuation APIs\n" ,
152
- ) ;
150
+ " 3. Calling Continuation APIs\n" ;
151
+
152
+ const error = new RbValue ( this . guest . rbErrinfo ( ) , this , this . privateObject ( ) ) ;
153
+ if ( error . call ( "nil?" ) . toString ( ) === "false" ) {
154
+ message += "\n" + this . exceptionFormatter . format ( error , this , this . privateObject ( ) ) ;
155
+ }
156
+ throw new RbFatalError ( message ) ;
153
157
} ,
154
158
} ;
155
159
// NOTE: The GC may collect objects that are still referenced by Wasm
You can’t perform that action at this time.
0 commit comments