Error
public extension Error
-
Returns the respective
ParseError
if the givenParseError
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 theError
. If the error is not aParseError
, 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 theerrorCode
. -
Returns the respective
ParseError
if theError
is contained in the array ofParseError
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 theError
. If the error is not aParseError
, returns nil. -
Returns the respective
ParseError
if theError
is contained in the list ofParseError
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 theError
. If the error is not aParseError
, 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 theerrorCodes
. -
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 theerrorCodes
.