Skip to content

Commit f05abfe

Browse files
committed
safety check for when parser options prevents converter to work
1 parent b4bdbcf commit f05abfe

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/parse.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,25 @@ internal object Parsers : GlobalParserOptions {
925925
val resolvedParsers = parsers.map { it.applyOptions(options) }
926926
val resolvedFallbackParsers = parsers.map { it.applyOptionsToFallbackParserForConverter(options) }
927927

928+
if (resolvedParsers.all { it == SKIP_PARSER }) {
929+
throw TypeConversionException(
930+
value = null,
931+
from = typeOf<String>(),
932+
to = type,
933+
column = null,
934+
extraInformation = buildString {
935+
append("All parsers for type $type were skipped. If this is unexpected, ")
936+
if (options != null) {
937+
append(
938+
"check your provided parser options: $options, as well as the global parser options at `DataFrame.parser`.",
939+
)
940+
} else {
941+
append("check the global parser options at `DataFrame.parser`.")
942+
}
943+
},
944+
)
945+
}
946+
928947
val typeConverter =
929948

930949
fun(str: String): Any? {

0 commit comments

Comments
 (0)