mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
948 B
Swift
29 lines
948 B
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
//
|
|
// stringlint:disable
|
|
|
|
import Foundation
|
|
|
|
public enum HTTPError: LocalizedError, Equatable {
|
|
case generic
|
|
case invalidURL
|
|
case invalidJSON
|
|
case parsingFailed
|
|
case invalidResponse
|
|
case maxFileSizeExceeded
|
|
case httpRequestFailed(statusCode: UInt, data: Data?)
|
|
case timeout
|
|
|
|
public var errorDescription: String? {
|
|
switch self {
|
|
case .generic: return "An error occurred."
|
|
case .invalidURL: return "Invalid URL."
|
|
case .invalidJSON: return "Invalid JSON."
|
|
case .parsingFailed, .invalidResponse: return "Invalid response."
|
|
case .maxFileSizeExceeded: return "Maximum file size exceeded."
|
|
case .httpRequestFailed(let statusCode, _): return "HTTP request failed with status code: \(statusCode)."
|
|
case .timeout: return "The request timed out."
|
|
}
|
|
}
|
|
}
|