Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Modules/Sources/WordPressCore/ApiCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import WordPressAPI
import WordPressAPIInternal
import WordPressApiCache
import WordPressShared

extension WordPressApiCache {
static func bootstrap() -> WordPressApiCache {
Expand All @@ -10,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")

Expand All @@ -27,7 +26,7 @@ extension WordPressApiCache {
return cache
}
} catch {
NSLog("Failed to delete sqlite database: \(error)")
wpAssertionFailure("Failed to delete sqlite database")
}
}

Expand All @@ -39,14 +38,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
}

Expand All @@ -56,7 +55,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import WordPressCore
import WordPressData
import WordPressAPI
import WordPressAPIInternal
import WordPressShared
import WordPressUI

struct CustomPostTypesView: View {
Expand Down Expand Up @@ -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 {
Expand Down