Skip to content

Commit 34e1807

Browse files
authored
fix(java-shell): allow console.warn and console.info (#1040)
eea5cd6 broke the waterfall tests, because BSON uses console.warn() when applied to the java shell as no secure random number generator is available, and the change upgraded the resulting error from a silent unhandled promise rejection to a full exception. Solve this by adding warn and info to the java-shell console for parity with the shell-api code.
1 parent 6a1bec6 commit 34e1807

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/java-shell/src/main/kotlin/com/mongodb/mongosh/ConsoleLogSupport.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ internal class ConsoleLogSupport(context: MongoShellContext, converter: MongoShe
1414
@Suppress("JSPrimitiveTypeWrapperUsage")
1515
val console = context.eval("new Object()")
1616
console["log"] = print
17+
console["warn"] = print
1718
console["error"] = print
19+
console["info"] = print
1820
context.bindings["console"] = console
1921
}
2022

@@ -26,4 +28,4 @@ internal class ConsoleLogSupport(context: MongoShellContext, converter: MongoShe
2628
this.printedValues = null
2729
}
2830
}
29-
}
31+
}

0 commit comments

Comments
 (0)