From c5b611b39e16bd339282310ab3a65fdafa98e939 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Thu, 26 May 2022 07:31:11 -0400 Subject: [PATCH] Add FIXME to track silent failure on fetching collections MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As collections are fetched and added to the `list` property in the CollectionListModel’s initializer, it’s tricky to throw an error here: we call it as a property initializer in CollectionListView, which cannot throw. Consider refactoring this logic such that we’re using, for example, a @FetchRequest in CollectionListView instead. --- Shared/PostCollection/CollectionListModel.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Shared/PostCollection/CollectionListModel.swift b/Shared/PostCollection/CollectionListModel.swift index 5e107bb..86e4088 100644 --- a/Shared/PostCollection/CollectionListModel.swift +++ b/Shared/PostCollection/CollectionListModel.swift @@ -19,6 +19,7 @@ class CollectionListModel: NSObject, ObservableObject { try collectionsController.performFetch() list = collectionsController.fetchedObjects ?? [] } catch { + // FIXME: Errors cannot be thrown out of the CollectionListView property initializer print("Failed to fetch collections!") } }