NSError
Undocumented
-
Convenience creator for a
JSONResponseErrorDomain
error with codeJSONResponseUnexpectedTypeCode
. Description and failure reason can be set through the optional parameters.Declaration
Swift
public static func unexpectedTypeErrorForJSON(json:JSON, expectedType:Type, localizedDescription: String = "Unable to create object.", localizedFailureReason: String = "Unexpected JSON format. Expected '%@', got '%@'") -> NSError
Parameters
json
The
JSON
object of the unexpected type.expectedType
The
JSON.Type
that was expected.localizedDescription
The
localizedDescription
for the error being created. Default value isUnable to create object.
.localizedFailureReason
The
localizedFailureReason
for the error being created. Default value isUnexpected JSON format. Expected ’%@’, got ’%@’
, where the two arguments are theexpectedType
and actual type ofjson
. -
Convenience creator for a
JSONResponseErrorDomain
error with codeJSONResponseMissingElementCode
. Description and failure reason can be set through the optional parameters.Declaration
Swift
public static func missingElementErrorForJSON(json:JSON, localizedDescription: String = "Unable to create object.", localizedFailureReason: String = "Missing required elements.") -> NSError
Parameters
json
The
JSON
object of the unexpected type.localizedDescription
The
localizedDescription
for the error being created. Default value isUnable to create object.
.localizedFailureReason
The
localizedFailureReason
for the error being created. Default value isMissing required elements.
.