You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is reasonable to rewrite error messages to whatever users find more understandable (e.g. less technical jargon, add use-case recommendations, translate to a different language). Catching DecodingError with a string description is not friendly to that, because descriptions can be revised in future changes. Imo the cleanest solution is to subclass. Maybe something like this:
sealed class DecodingError(params: Params): TomlException() {
internal data class Params (
val reason: String,
val sourceValue: TomlValue,
val targetType: KType,
val cause: Throwable? = null
)
val reason = params.reason
val sourceValue = params.sourceValue
val targetType = params.targetType
override val cause: Throwable? = params.cause
}
class NoValueForNonNullableParameter internal constructor(params: Params): DecodingError(params)
....
throw NoValueForNonNullableParameter(DecodingError.Params(
"no value found for non-nullable parameter '${constructorParameter.name}'",
tomlMap,
kType
))
The text was updated successfully, but these errors were encountered:
Fixes#15.
* Bump dependency versions.
* Split encoder and decoder errors into one type per possible error.
* Split serialization errors into separate types.
* Document new exceptions.
It is reasonable to rewrite error messages to whatever users find more understandable (e.g. less technical jargon, add use-case recommendations, translate to a different language). Catching
DecodingError
with a string description is not friendly to that, because descriptions can be revised in future changes. Imo the cleanest solution is to subclass. Maybe something like this:The text was updated successfully, but these errors were encountered: