validateProviderTimeoutsSection function

void validateProviderTimeoutsSection(
  1. Object? node
)

The strict providerTimeouts: section validator (mirrors the public parser parseProviderTimeouts in cli_config.dart; pinned by test). Shared by check, set and the settings flow (issue #393).

Implementation

void validateProviderTimeoutsSection(Object? node) {
  if (node is! YamlMap) {
    throw ConfigException('must be a map, got: $node');
  }
  for (final entry in node.entries) {
    final key = '${entry.key}';
    if (key != 'connectTimeoutMs' && key != 'streamIdleTimeoutMs') {
      throw ConfigException('unknown "providerTimeouts" key: $key');
    }
    final value = entry.value;
    if (value is! int || value <= 0) {
      throw ConfigException(
        '"providerTimeouts.$key" must be a positive integer (milliseconds)',
      );
    }
  }
}