From cb3566fde106f75f2ce3d5901146e4084581be8f Mon Sep 17 00:00:00 2001 From: Tim Yiu <137842098+tyiuhc@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:05:36 -0800 Subject: [PATCH] Update Sources/Experiment/ExperimentClient.swift Co-authored-by: Brian Giori --- Sources/Experiment/ExperimentClient.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/Experiment/ExperimentClient.swift b/Sources/Experiment/ExperimentClient.swift index 797fdb2..3820ad7 100644 --- a/Sources/Experiment/ExperimentClient.swift +++ b/Sources/Experiment/ExperimentClient.swift @@ -679,11 +679,10 @@ internal class DefaultExperimentClient : NSObject, ExperimentClient { } private func shouldRetryFetch(_ e: Error) -> Bool { - if (e is FetchError) { - let fetchError = e as! FetchError - return fetchError.statusCode < 400 || fetchError.statusCode >= 500 || fetchError.statusCode == 429 + guard let e = e as FetchError else { + return true } - return true + return fetchError.statusCode < 400 || fetchError.statusCode >= 500 || fetchError.statusCode == 429 } }