ValueException

open class ValueException<T> : Exception

An exception caused by an incorrect value.

  • The value that caused the exception.

    Declaration

    Swift

    public let actualValue: T
  • Initializes an Exception instance.

    Declaration

    Swift

    public init(error:Error, message:String?, actualValue:T, stackTrace:[String]? = nil)

    Parameters

    error

    The error causing the exception.

    message

    A human-readable message explaining the error.

    actualValue

    The (incorrect) value causing the exception.

    stackTrace

    The stack trace at the time the exception was thrown. Defaults to Thread.callStackSymbols.

  • Constructs a ValueException with a message displaying expected value.

    Declaration

    Swift

    public static func expected(value: T, error: Error, actualValue: T) -> ValueException<T>

    Parameters

    value

    The expected value.

    error

    The error the exception represents.

    actualValue

    The actual value causing the error. Must not be value.

    Return Value

    A ValueException instance.

  • Declaration

    Swift

    open override func descriptionComponents() -> [String]