validateOrThrow method

void validateOrThrow(
  1. String typeName,
  2. IPLDNode node
)

Validates node against typeName, throwing IPLDSchemaError with the first precise error path when the node does not match.

Synchronous: never resolves links — see check.

Implementation

void validateOrThrow(String typeName, IPLDNode node) {
  final result = check(typeName, node);
  if (!result.isValid) {
    throw IPLDSchemaError(
      'Node does not match type "$typeName": ${result.errors.first}',
    );
  }
}