NSError

Undocumented

  • Convenience creator for a JSONResponseErrorDomain error with code JSONResponseUnexpectedTypeCode. 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 is Unable to create object..

    localizedFailureReason

    The localizedFailureReason for the error being created. Default value is Unexpected JSON format. Expected ’%@’, got ’%@’, where the two arguments are the expectedType and actual type of json.

  • Convenience creator for a JSONResponseErrorDomain error with code JSONResponseMissingElementCode. 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 is Unable to create object..

    localizedFailureReason

    The localizedFailureReason for the error being created. Default value is Missing required elements..