From 268880a4383a9b461fdf257a1ec6b4deb822f6d2 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Thu, 25 Jan 2024 12:47:46 +0100 Subject: [PATCH 1/2] Don't report CancellationError to BookmarksFaviconsFetcher's error handler --- .../Bookmarks/FaviconsFetcher/BookmarksFaviconsFetcher.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Bookmarks/FaviconsFetcher/BookmarksFaviconsFetcher.swift b/Sources/Bookmarks/FaviconsFetcher/BookmarksFaviconsFetcher.swift index 9a8943bec..16e2f2706 100644 --- a/Sources/Bookmarks/FaviconsFetcher/BookmarksFaviconsFetcher.swift +++ b/Sources/Bookmarks/FaviconsFetcher/BookmarksFaviconsFetcher.swift @@ -199,7 +199,7 @@ public final class BookmarksFaviconsFetcher { self?.fetchingDidFinishSubject.send(.failure(error)) if let fetcherError = error as? BookmarksFaviconsFetcherError { self?.errorEvents?.fire(fetcherError) - } else { + } else if !(error is CancellationError) { self?.errorEvents?.fire(.other(error)) } } else { From 14e13a4731114007b4ccd95a5cdaca96d7c0d6c5 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Thu, 25 Jan 2024 13:17:48 +0100 Subject: [PATCH 2/2] Fix tests --- Package.resolved | 4 ++-- .../FaviconsFetcher/BookmarksFaviconsFetcherTests.swift | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Package.resolved b/Package.resolved index 17de1bb16..69c89b395 100644 --- a/Package.resolved +++ b/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/duckduckgo/content-scope-scripts", "state" : { - "revision" : "bb027f14bec7fbb1a85d308139e7a66686da160e", - "version" : "4.59.0" + "revision" : "0b68b0d404d8d4f32296cd84fa160b18b0aeaf44", + "version" : "4.59.1" } }, { diff --git a/Tests/BookmarksTests/FaviconsFetcher/BookmarksFaviconsFetcherTests.swift b/Tests/BookmarksTests/FaviconsFetcher/BookmarksFaviconsFetcherTests.swift index e1780a37e..566bb2990 100644 --- a/Tests/BookmarksTests/FaviconsFetcher/BookmarksFaviconsFetcherTests.swift +++ b/Tests/BookmarksTests/FaviconsFetcher/BookmarksFaviconsFetcherTests.swift @@ -220,15 +220,12 @@ final class BookmarksFaviconsFetcherTests: XCTestCase { await runAfterOperationsFinished { XCTAssertEqual(results.count, 1) - guard case .failure = results.first else { - XCTFail("Expected failure") - return - } - XCTAssertEqual(MockBookmarksFaviconsFetcherEventMapper.errors.count, 1) - guard MockBookmarksFaviconsFetcherEventMapper.errors[0].underlyingError is CancellationError else { + guard case .failure(let error) = results.first, error is CancellationError else { XCTFail("Expected CancellationError") return } + // Cancellation errors are not reported + XCTAssertTrue(MockBookmarksFaviconsFetcherEventMapper.errors.isEmpty) } cancellable.cancel() }