Error

public extension Error
  • Returns the respective ParseError if the given ParseError code is equal to the error.

    Example use case:

    if let parseError = error.equalsTo(.objectNotFound)  {
        print(parseError.description)
    }
    

    Declaration

    Swift

    func equalsTo(_ errorCode: ParseError.Code) -> ParseError?

    Parameters

    errorCode

    A ParseError code to compare to.

    Return Value

    Returns the ParseError with respect to the Error. If the error is not a ParseError, returns nil.

  • Validates if the given ParseError code is equal to the error.

    Example use case:

    if error.equalsTo(.objectNotFound)  {
        //Do stuff
    }
    

    Declaration

    Swift

    func equalsTo(_ errorCode: ParseError.Code) -> Bool

    Parameters

    errorCode

    A ParseError code to compare to.

    Return Value

    A boolean indicating whether or not the Error is the errorCode.

  • Returns the respective ParseError if the Error is contained in the array of ParseError codes.

    Example use case:

    if let parseError = error.containedIn([.objectNotFound, .invalidQuery])  {
        print(parseError.description)
    }
    

    Declaration

    Swift

    func containedIn(_ errorCodes: [ParseError.Code]) -> ParseError?

    Parameters

    errorCodes

    An array of zero or more of ParseError codes to compare to.

    Return Value

    Returns the ParseError with respect to the Error. If the error is not a ParseError, returns nil.

  • Returns the respective ParseError if the Error is contained in the list of ParseError codes.

    Example use case:

    if let parseError = error.containedIn(.objectNotFound, .invalidQuery)  {
        print(parseError.description)
    }
    

    Declaration

    Swift

    func containedIn(_ errorCodes: ParseError.Code...) -> ParseError?

    Parameters

    errorCodes

    A variadic amount of zero or more of ParseError codes to compare to.

    Return Value

    Returns the ParseError with respect to the Error. If the error is not a ParseError, returns nil.

  • Validates if the given ParseError codes contains the error.

    Example use case:

    if error.containedIn([.objectNotFound, .invalidQuery])  {
        //Do stuff
    }
    

    Declaration

    Swift

    func containedIn(_ errorCodes: [ParseError.Code]) -> Bool

    Parameters

    errorCodes

    An array of zero or more of ParseError codes to compare to.

    Return Value

    A boolean indicating whether or not the Error is contained in the errorCodes.

  • Validates if the given ParseError codes contains the error.

    Example use case:

    if error.containedIn(.objectNotFound, .invalidQuery)  {
        //Do stuff
    }
    

    Declaration

    Swift

    func containedIn(_ errorCodes: ParseError.Code...) -> Bool

    Parameters

    errorCodes

    A variadic amount of zero or more of ParseError codes to compare to.

    Return Value

    A boolean indicating whether or not the Error is contained in the errorCodes.