Kaynağa Gözat

The manager should propagate the error to upper level

onevcat 11 ay önce
ebeveyn
işleme
91524ce0c7
1 değiştirilmiş dosya ile 4 ekleme ve 6 silme
  1. 4 6
      Sources/General/KingfisherManager.swift

+ 4 - 6
Sources/General/KingfisherManager.swift

@@ -649,7 +649,7 @@ public class KingfisherManager: @unchecked Sendable {
                     }
                 } onFailure: { error in
                     options.callbackQueue.execute {
-                        completionHandler(.failure(KingfisherError.cacheError(reason: .imageNotExisting(key: key))))
+                        completionHandler(.failure(error))
                     }
                 }
             }
@@ -728,13 +728,11 @@ public class KingfisherManager: @unchecked Sendable {
                             }
                         }
                     },
-                    onFailure: { _ in
+                    onFailure: { error in
                         // This should not happen actually, since we already confirmed `originalImageCached` is `true`.
                         // Just in case...
-                        options.callbackQueue.execute {
-                            completionHandler?(
-                                .failure(KingfisherError.cacheError(reason: .imageNotExisting(key: key)))
-                            )
+                        if let completionHandler = completionHandler {
+                            options.callbackQueue.execute { completionHandler(.failure(error)) }
                         }
                     }
                 )