Clean up ahead of PR.

This commit is contained in:
Matthew Chen 2021-08-13 12:46:52 -03:00
parent e7ac736f7d
commit cc83178d10
6 changed files with 22 additions and 15 deletions

View File

@ -164,11 +164,6 @@ public class MessageSenderErrorNoValidRecipients: NSObject, CustomNSError, IsRet
MessageSenderErrorNoValidRecipients() as Error as NSError
}
public var localizedDescription: String {
NSLocalizedString("ERROR_DESCRIPTION_NO_VALID_RECIPIENTS",
comment: "Error indicating that an outgoing message had no valid recipients.")
}
/// NSError bridging: the domain of the error.
/// :nodoc:
@objc
@ -189,6 +184,11 @@ public class MessageSenderErrorNoValidRecipients: NSObject, CustomNSError, IsRet
[NSLocalizedDescriptionKey: self.localizedDescription]
}
public var localizedDescription: String {
NSLocalizedString("ERROR_DESCRIPTION_NO_VALID_RECIPIENTS",
comment: "Error indicating that an outgoing message had no valid recipients.")
}
public var isRetryableProvider: Bool { false }
}
@ -215,12 +215,6 @@ public class MessageSenderNoSessionForTransientMessageError: NSObject, CustomNSE
/// :nodoc:
public var errorCode: Int { Self.errorCode }
/// NSError bridging: the error code within the given domain.
/// :nodoc:
public var errorUserInfo: [String: Any] {
[NSLocalizedDescriptionKey: self.localizedDescription]
}
public var isRetryableProvider: Bool { false }
}

View File

@ -46,6 +46,7 @@ public class RESTSessionManager: NSObject {
success: @escaping RESTNetworkManagerSuccess,
failure: @escaping RESTNetworkManagerFailure) {
assertOnQueue(NetworkManagerQueue())
owsAssertDebug(!FeatureFlags.deprecateREST)
guard let rawRequestUrl = request.url else {
owsFailDebug("Missing requestUrl.")

View File

@ -385,9 +385,7 @@ public class OWSURLSession: NSObject {
@objc
public static var signalIosUserAgent: String {
let result = "Signal-iOS/\(AppVersion.shared().currentAppVersionLong) iOS/\(UIDevice.current.systemVersion)"
Logger.verbose("---- userAgent: \(result)")
return result
"Signal-iOS/\(AppVersion.shared().currentAppVersionLong) iOS/\(UIDevice.current.systemVersion)"
}
private func buildUrl(_ urlString: String) -> URL? {

View File

@ -308,6 +308,13 @@ public extension Error {
HTTPResponseDataForError(self)
}
var httpRequestUrl: URL? {
guard let error = self as? HTTPError else {
return nil
}
return error.requestUrl
}
var httpResponseJson: Any? {
guard let data = httpResponseData else {
return nil

View File

@ -46,6 +46,13 @@ extension NSError {
Logger.verbose("Network error without retry behavior specified: \(self)")
return true
}
// Do not retry 4xx errors.
if let statusCode = (self as Error).httpStatusCode,
statusCode >= 400,
statusCode <= 499 {
Logger.info("Not retrying error: \(statusCode), \(String(describing: (self as Error).httpRequestUrl))")
return false
}
// This value should always be set for all errors by this
// var is consulted. If not, default to retrying in production.

View File

@ -202,7 +202,7 @@ public class FeatureFlags: BaseFlags {
public static let deprecateREST = false
@objc
public static let newHostNames = false
public static let newHostNames = build.includes(.qa)
public static func buildFlagMap() -> [String: Any] {
BaseFlags.buildFlagMap(for: FeatureFlags.self) { (key: String) -> Any? in