             errorType: nil,
             closure: closure
         )
+
         var matches = false
         if let actualError = actualError as? T, error == actualError {
             matches = true

///
/// The closure only gets called when an error was thrown.
public func throwError(closure: @escaping ((Error) -> Void)) -> Predicate<Any> {
    return Predicate.fromDeprecatedClosure { actualExpression, failureMessage in

        var actualError: Error?
        do {
            _ = try actualExpression.evaluate()
        } catch let catchedError {
            actualError = catchedError
        }

        setFailureMessageForError(failureMessage, actualError: actualError, closure: closure)

        var matches = false

/// nil arguments indicates that the matcher should not attempt to match against
/// that parameter.
public func throwError<T: Error & Equatable>(_ error: T, closure: ((T) -> Void)? = nil) -> Predicate<Any> {
    return Predicate { actualExpression in
        var actualError: Error?
        do {
            _ = try actualExpression.evaluate()
        } catch {
            actualError = error
        }

        let failureMessage = FailureMessage()
        setFailureMessageForError(
            failureMessage,
            actualError: actualError,
