@@ -71,6 +71,7 @@ class MongoshNodeRepl implements EvaluationListener {
71
71
insideAutoComplete : boolean ;
72
72
inspectDepth = 0 ;
73
73
started = false ;
74
+ showStackTraces = false ;
74
75
75
76
constructor ( options : MongoshNodeReplOptions ) {
76
77
this . input = options . input ;
@@ -95,6 +96,7 @@ class MongoshNodeRepl implements EvaluationListener {
95
96
await this . printStartupLog ( internalState ) ;
96
97
97
98
this . inspectDepth = await this . getConfig ( 'inspectDepth' ) ;
99
+ this . showStackTraces = await this . getConfig ( 'showStackTraces' ) ;
98
100
99
101
const repl = asyncRepl . start ( {
100
102
start : prettyRepl . start ,
@@ -414,12 +416,13 @@ class MongoshNodeRepl implements EvaluationListener {
414
416
return clr ( text , style , this . getFormatOptions ( ) ) ;
415
417
}
416
418
417
- getFormatOptions ( ) : { colors : boolean , depth : number } {
419
+ getFormatOptions ( ) : { colors : boolean , depth : number , showStackTraces : boolean } {
418
420
const output = this . output as WriteStream ;
419
421
return {
420
422
colors : this . _runtimeState ?. repl ?. useColors ??
421
423
( output . isTTY && output . getColorDepth ( ) > 1 ) ,
422
- depth : this . inspectDepth
424
+ depth : this . inspectDepth ,
425
+ showStackTraces : this . showStackTraces
423
426
} ;
424
427
}
425
428
@@ -458,6 +461,9 @@ class MongoshNodeRepl implements EvaluationListener {
458
461
if ( key === 'inspectDepth' ) {
459
462
this . inspectDepth = + value ;
460
463
}
464
+ if ( key === 'showStackTraces' ) {
465
+ this . showStackTraces = ! ! value ;
466
+ }
461
467
return this . ioProvider . setConfig ( key , value ) ;
462
468
}
463
469
0 commit comments