File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/npm-packages/ruby-wasm-wasi/src Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -406,6 +406,12 @@ class RbExceptionFormatter {
406
406
} ) ( ) ;
407
407
408
408
const backtrace = error . call ( "backtrace" ) ;
409
+ if ( backtrace . call ( "nil?" ) . toString ( ) === "true" ) {
410
+ return this . formatString (
411
+ error . call ( "class" ) . toString ( ) ,
412
+ error . toString ( )
413
+ ) ;
414
+ }
409
415
const firstLine = backtrace . call ( "at" , zeroLiteral ) ;
410
416
const restLines = backtrace
411
417
. call ( "drop" , oneLiteral )
@@ -419,9 +425,13 @@ class RbExceptionFormatter {
419
425
formatString (
420
426
klass : string ,
421
427
message : string ,
422
- backtrace : [ string , string ]
428
+ backtrace ? : [ string , string ]
423
429
) : string {
424
- return `${ backtrace [ 0 ] } : ${ message } (${ klass } )\n${ backtrace [ 1 ] } ` ;
430
+ if ( backtrace ) {
431
+ return `${ backtrace [ 0 ] } : ${ message } (${ klass } )\n${ backtrace [ 1 ] } ` ;
432
+ } else {
433
+ return `${ klass } : ${ message } ` ;
434
+ }
425
435
}
426
436
}
427
437
You can’t perform that action at this time.
0 commit comments