Commit aa63b4a
committed
Account for empty data store in
Previously, the `GetContentTypeDescriptors()` call threw an exception if it was unable to load the `Root:Configuration:ContentTypes` from the underlying data store. That made good sense at the time. But as we've introduced the **OnTopic Data Exchange** into the **OnTopic Editor**, we now want to allow an empty database to be initialized by importing reference JSON files. This can't happen if the application throws an exception before getting to that point.
To mitigate this, we've now removed these exceptions and allowed for a scenario where `GetContentTypeDescriptors()` finds no content type descriptors in the underlying data store.
It's worth noting that exceptions will still be thrown in this scenario, they'll just be thrown by the `TopicRepositoryBase.Save()` method which reliesupon that cache, instead of happening as part of `GetContentTypeDescriptors()` itself. That still introduces the potential that other callers, besides `Save()`, will get an empty set, but that allows them to handle it as appropriate—e.g., ignoring it if they are alright with it, otherwise throwing an exception.
Technically, this is a breaking change in that now `GetContentTypeDescriptors()` can return an empty collection instead of throwing an exception. Since the only current implementors of `TopicRepositoryBase` are part of this repository, however, and the exception wasn't previously documented, we can safely make this change without any concern over breaking implementations.GetContentTypeDescriptors()
1 parent f906d26 commit aa63b4a
1 file changed
Lines changed: 2 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 75 | + | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
| |||
107 | 103 | | |
108 | 104 | | |
109 | 105 | | |
110 | | - | |
| 106 | + | |
111 | 107 | | |
112 | 108 | | |
113 | 109 | | |
| |||
0 commit comments