validateRedactSection function

void validateRedactSection(
  1. Object? value
)

The strict redact: section validator, shared by check, set and the settings flow (issue #391). RedactionConfig.fromYaml is tolerant for booleans and numbers, but an invalid allowlist regex throws a bare FormatException mid-parse — wrapped here so every caller surfaces the parser's verbatim message as a ConfigException instead of crashing (a config set redact.allowlist used to escape the diagnostics pass uncaught).

Implementation

void validateRedactSection(Object? value) {
  try {
    RedactionConfig.fromYaml(value is Map<dynamic, dynamic> ? value : null);
  } on ConfigException {
    rethrow;
  } on Object catch (error) {
    throw ConfigException(error.toString());
  }
}