From cabc5dfff0197d0a8f41e7455466ce884e176482 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Wed, 18 Feb 2026 09:56:28 +1300 Subject: [PATCH 1/2] Add a new `wpAssert` --- Modules/Sources/WordPressCore/ApiCache.swift | 9 +++++---- .../CustomPostTypes/CustomPostTypesView.swift | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Modules/Sources/WordPressCore/ApiCache.swift b/Modules/Sources/WordPressCore/ApiCache.swift index e3425c42d226..e6c629d16cbb 100644 --- a/Modules/Sources/WordPressCore/ApiCache.swift +++ b/Modules/Sources/WordPressCore/ApiCache.swift @@ -2,6 +2,7 @@ import Foundation import WordPressAPI import WordPressAPIInternal import WordPressApiCache +import WordPressShared extension WordPressApiCache { static func bootstrap() -> WordPressApiCache { @@ -27,7 +28,7 @@ extension WordPressApiCache { return cache } } catch { - NSLog("Failed to delete sqlite database: \(error)") + wpAssertionFailure("Failed to delete sqlite database") } } @@ -39,14 +40,14 @@ extension WordPressApiCache { do { cache = try WordPressApiCache(url: file) } catch { - NSLog("Failed to create an instance: \(error)") + wpAssertionFailure("Failed to create an instance") return nil } do { _ = try cache.performMigrations() } catch { - NSLog("Failed to migrate database: \(error)") + wpAssertionFailure("Failed to migrate database") return nil } @@ -56,7 +57,7 @@ extension WordPressApiCache { values.isExcludedFromBackup = true try url.setResourceValues(values) } catch { - NSLog("Failed exclude the database file from iCloud backup: \(error)") + wpAssertionFailure("Failed exclude the database file from iCloud backup") } return cache diff --git a/WordPress/Classes/ViewRelated/CustomPostTypes/CustomPostTypesView.swift b/WordPress/Classes/ViewRelated/CustomPostTypes/CustomPostTypesView.swift index 09ca6766a2b5..72c46d35f90a 100644 --- a/WordPress/Classes/ViewRelated/CustomPostTypes/CustomPostTypesView.swift +++ b/WordPress/Classes/ViewRelated/CustomPostTypes/CustomPostTypesView.swift @@ -4,6 +4,7 @@ import WordPressCore import WordPressData import WordPressAPI import WordPressAPIInternal +import WordPressShared import WordPressUI struct CustomPostTypesView: View { @@ -106,6 +107,8 @@ struct CustomPostTypesView: View { return NavigationLink { if let wpService = service.wpService { CustomPostTabView(client: service.client, service: wpService, endpoint: details.toPostEndpointType(), details: details, blog: blog) + } else { + let _ = wpAssertionFailure("Expected wpService to be available") } } label: { HStack { From 1048d5e9fd989808411db632d6b5c13cc9d8e3b7 Mon Sep 17 00:00:00 2001 From: Tony Li Date: Wed, 18 Feb 2026 09:59:07 +1300 Subject: [PATCH 2/2] Remove a TODO --- Modules/Sources/WordPressCore/ApiCache.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Modules/Sources/WordPressCore/ApiCache.swift b/Modules/Sources/WordPressCore/ApiCache.swift index e6c629d16cbb..c77da9ecdb51 100644 --- a/Modules/Sources/WordPressCore/ApiCache.swift +++ b/Modules/Sources/WordPressCore/ApiCache.swift @@ -11,8 +11,6 @@ extension WordPressApiCache { return instance } - // TODO: - // - Log errors to sentry: https://github.com/wordpress-mobile/WordPress-iOS/pull/25157#discussion_r2785458461 private static func onDiskCache() -> WordPressApiCache? { let cacheURL = URL.libraryDirectory.appending(path: "app.sqlite")