Contents

require(_:sourceLocation:performing:throws:)

Check that an expression always throws an error matching some condition, and throw an error if it does not.

Declaration

@discardableResult @freestanding(expression) macro require<R>(_ comment: @autoclosure () -> Comment? = nil, sourceLocation: SourceLocation = #_sourceLocation, performing expression: () async throws -> R, throws errorMatcher: (any Error) async throws -> Bool) -> any Error

See Also

Checking that errors are thrown