Skip to content

Commit baf8a4b

Browse files
committed
now with a url in the error
1 parent 8e9302c commit baf8a4b

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/Integration.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ internal class Integration(
7070
setMinimalKernelVersion(MIN_KERNEL_VERSION)
7171
} catch (_: NoSuchMethodError) { // will be thrown on version < 0.11.0.198
7272
throw IllegalStateException(
73-
"Your Kotlin Jupyter kernel version appears to be out of date (version ${notebook.kernelVersion}). " +
74-
"Please update to version $MIN_KERNEL_VERSION or higher to be able to use DataFrame."
73+
getKernelUpdateMessage(notebook.kernelVersion, MIN_KERNEL_VERSION, notebook.jupyterClientType)
7574
)
7675
}
7776
val codeGen = ReplCodeGenerator.create()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.jetbrains.kotlinx.dataframe.jupyter
2+
3+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType
4+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.DATALORE
5+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.JUPYTER_LAB
6+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.JUPYTER_NOTEBOOK
7+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.KERNEL_TESTS
8+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.KOTLIN_NOTEBOOK
9+
import org.jetbrains.kotlinx.jupyter.api.JupyterClientType.UNKNOWN
10+
import org.jetbrains.kotlinx.jupyter.api.KotlinKernelVersion
11+
12+
private const val UPDATING_DATALORE_URL = "https://github.com/Kotlin/kotlin-jupyter/tree/master#datalore"
13+
private const val UPDATING = "https://github.com/Kotlin/kotlin-jupyter/tree/master#updating"
14+
15+
internal fun getKernelUpdateMessage(
16+
kernelVersion: KotlinKernelVersion,
17+
minKernelVersion: String,
18+
clientType: JupyterClientType,
19+
): String = buildString {
20+
append("Your Kotlin Jupyter kernel version appears to be out of date (version $kernelVersion). ")
21+
appendLine("Please update it to version $minKernelVersion or newer to be able to use DataFrame.")
22+
append("Follow the instructions at: ")
23+
24+
when (clientType) {
25+
DATALORE ->
26+
appendLine(UPDATING_DATALORE_URL)
27+
28+
KERNEL_TESTS, JUPYTER_NOTEBOOK, JUPYTER_LAB, KOTLIN_NOTEBOOK, UNKNOWN ->
29+
appendLine(UPDATING)
30+
}
31+
}

0 commit comments

Comments
 (0)