Commit 8aacc5a
committed
Validate
The `Load(topic, version)` is intended to load a previous version of the supplied topic. This is a friendly overload which calls `Load(topicId, version, topic)`. If `topic.IsNew`, however, then it will either fail—or, worse, potentially (attempt to) return that version of the root topic (if it exists). This is because an `IsNew` topic has an `Id` of -1, but some persistence stores treat requests to load a topic with an `Id` of -1 as a reference to the root.
Regardless, this is expected to either fail or return incorrect results if the topic `IsNew`. Given that, it's better to validate this upfront and return a clear error message regarding the issue.
This contributes to #77.IsNew on Load(topic, version)
1 parent 646eb92 commit 8aacc5a
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
226 | 231 | | |
227 | 232 | | |
228 | 233 | | |
| |||
0 commit comments