ConfigError

sealed class ConfigError(source)

Why a key failed to load. The subclasses are plain classes rather than data classes, so fields can be added later without breaking callers; they still compare by value.

Inheritors

Types

Link copied to clipboard
class ConversionFailed(val key: String, val rawValue: String, val targetType: String, val cause: String) : ConfigError

The value for key could not be converted to the field's type.

Link copied to clipboard

No source had a value for key, and the field has no default and is not nullable.

Link copied to clipboard
class NestedFailure(val key: String, val errors: List<ConfigError>) : ConfigError

Groups the errors of a nested config under key. Generated loaders never produce it: they report a nested spec's errors directly, with the nested prefix in each key. It is available for hand-written loaders.

Link copied to clipboard
class ValidationFailed(val key: String, val rawValue: String?, val reason: String) : ConfigError

A value converted fine but broke a validation rule, or the config class's init block rejected the loaded values. rawValue is null in the second case and *** for secrets.

Properties

Link copied to clipboard
abstract val key: String

The key that failed, as looked up in the source that supplied the value. For a missing key it is the SCREAMING_SNAKE form (or the @Key name). For a failed init check it is the spec's prefix, such as DATABASE for a nested spec, or the class name when there is none.

Link copied to clipboard
abstract val message: String

A readable description of the problem, used in ConfigException's message.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String