mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-28 19:11:30 +00:00
18 lines
541 B
Swift
18 lines
541 B
Swift
|
// Copyright © 2021 Metabolist. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
|
import HTTP
|
||
|
|
||
|
extension HTTPError: LocalizedError {
|
||
|
public var errorDescription: String? {
|
||
|
switch self {
|
||
|
case .nonHTTPURLResponse:
|
||
|
return NSLocalizedString("http-error.non-http-response", comment: "")
|
||
|
case let .invalidStatusCode(_, response):
|
||
|
return String.localizedStringWithFormat(
|
||
|
NSLocalizedString("http-error.status-code-%ld", comment: ""),
|
||
|
response.statusCode)
|
||
|
}
|
||
|
}
|
||
|
}
|