From d67b7cf850d43c2a8ecf39feedfc39528f55f139 Mon Sep 17 00:00:00 2001 From: Stephen Thomas <101900691+stephenth0ma5@users.noreply.github.com> Date: Tue, 12 Nov 2024 08:23:24 -0600 Subject: [PATCH] fix(auth): `URLError` coercion for `RetryableError` causing session to be deleted (#597) * Fixes url error coercion * Include non-url errors --- Sources/Auth/Internal/SessionManager.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Auth/Internal/SessionManager.swift b/Sources/Auth/Internal/SessionManager.swift index 80cfc0ae..684bbce7 100644 --- a/Sources/Auth/Internal/SessionManager.swift +++ b/Sources/Auth/Internal/SessionManager.swift @@ -106,7 +106,9 @@ private actor LiveSessionManager { // Need to do this check here, because not all RetryableError's should be retried. // URLError conforms to RetryableError, but only a subset of URLError should be retried, // the same is true for AuthError. - if let error = error as? any RetryableError, error.shouldRetry { + if let error = error as? URLError, error.shouldRetry { + throw error + } else if let error = error as? any RetryableError, error.shouldRetry { throw error } else { remove()