Config Error Collector
class ConfigErrorCollector
Mutable accumulator for ConfigError instances generated during deserialization and validation.
A single collector is threaded through the entire Deserializer call tree so that errors from nested data classes, collections, and annotation validators are gathered into one place. After deserialization completes, the caller inspects the collector to decide whether to use the (potentially partial) result or to abort.
Typical usage:
val errors = ConfigErrorCollector()
val config = deserializer.deserialize(MyConfig::class, yamlMap, errors)
if (errors.hasErrors()) {
println(ConfigErrorFormatter().format(errors.all(), "my-service"))
} else {
startService(config!!)
}Content copied to clipboard
The collector is not thread-safe; it is intended to be used within a single deserialization pass.
Since
1.0
See also
Functions
Link copied to clipboard
Appends a ConfigError to this collector.
Link copied to clipboard
Returns a snapshot (defensive copy) of all recorded errors.