TNError

public enum TNError : Error
extension TNError: LocalizedError

Custom error definition.

  • Thrown when the url is not valid.

    Declaration

    Swift

    case invalidURL
  • Thrown when the environment is not set.

    Declaration

    Swift

    case environmentNotSet
  • Thrown when the params contain invalid characters.

    Declaration

    Swift

    case invalidParams
  • Thrown when the response object is expected to be a UIImage but it’s not.

    Declaration

    Swift

    case responseInvalidImageData
  • Thrown when the given Codable type cannot be deserialized. It contains the className and the error about deserilization. was went wrong in parsing.

    Declaration

    Swift

    case cannotDeserialize(String, Error)
  • Thrown when the response object is expected to be a String but it’s not.

    Declaration

    Swift

    case cannotConvertToString
  • Thrown when a network error occured. It contains the NSURLError.

    Declaration

    Swift

    case networkError(Error)
  • Thrown when a request is not succeeded (it’s not 2xx). It contains the HTTP Status Code and the response Data.

    Declaration

    Swift

    case notSuccess(Int, Data)
  • Thrown when a request is cancelled.

    Declaration

    Swift

    case cancelled(Error?)
  • Thorwn when certificate pinning validation fails.

    Declaration

    Swift

    case pinningError
  • Thrown when a request is mocked but the data is invalid (e.g. cannot parse JSON).

    Declaration

    Swift

    case invalidMockData(String)
  • Thrown when a middleware reports an error. Throw this error in your custom middleware implementations if needed. It contains a custom type.

    Declaration

    Swift

    case middlewareError(Any)
  • Thrown when MultipartFormDataPartType param is expected but passed something else.

    Declaration

    Swift

    case invalidMultipartParams
  • Thrown when an invalid file path URL is passed on upload/download operations.

    Declaration

    Swift

    case invalidFileURL(String)
  • Thrown when the file cannot be saved to destination for some reason. It contains the Error with additional information.

    Declaration

    Swift

    case downloadedFileCannotBeSaved(Error)
  • Thrown when the transform method is not implemented (overriden in subclass).

    Declaration

    Swift

    case transformerNotImplemented
  • Thrown when the transformation failed for some reason, e.g. Incompatible Types

    Declaration

    Swift

    case transformationFailed
  • Thrown when a certificate path is invalid.

    Declaration

    Swift

    case invalidCertificatePath(String)
  • Thrown when the response headers cannot be retrieved. Typicaly when you forget to call the start() method.

    Declaration

    Swift

    case cannotReadResponseHeaders
  • Thrown when the response is empty.

    Declaration

    Swift

    case emptyResponse
  • Thrown the reachability core function call cannot be itialized.

    Declaration

    Swift

    case reachabilityError
  • A localized description for TNError.

    Declaration

    Swift

    public var localizedDescription: String? { get }