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 {
406406 } ) ( ) ;
407407
408408 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+ }
409415 const firstLine = backtrace . call ( "at" , zeroLiteral ) ;
410416 const restLines = backtrace
411417 . call ( "drop" , oneLiteral )
@@ -419,9 +425,13 @@ class RbExceptionFormatter {
419425 formatString (
420426 klass : string ,
421427 message : string ,
422- backtrace : [ string , string ]
428+ backtrace ? : [ string , string ]
423429 ) : 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+ }
425435 }
426436}
427437
You can’t perform that action at this time.
0 commit comments