Skip to content

Commit 3e143f1

Browse files
committed
Throw TopicNotFoundException in Load(int topicId, DateTime version)
Implemented the new `TopicNotFoundException` (2300e69) in `Load(int topicId, DateTime version)`. This was previously implemented for `Load(int topicId)` and `Load(string topicKey)`. These implementations previously threw a `NullReferenceException` if a topic wasn't found, which it shouldn't have been doing. Fortunately, it wasn't publicly documented, and no implementers have been catching it, so we're going to treat this as a bug fix, not a breaking change.
1 parent b5506b9 commit 3e143f1

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

OnTopic.Data.Sql/SqlTopicRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public override Topic Load(int topicId, DateTime version) {
254254
/*------------------------------------------------------------------------------------------------------------------------
255255
| Return objects
256256
\-----------------------------------------------------------------------------------------------------------------------*/
257-
return topic?? throw new NullReferenceException("The specified Topic version could not be loaded");
257+
return topic?? throw new TopicNotFoundException(topicId);
258258

259259
}
260260

OnTopic.TestDoubles/StubTopicRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public StubTopicRepository() : base() {
9797
/*------------------------------------------------------------------------------------------------------------------------
9898
| Return objects
9999
\-----------------------------------------------------------------------------------------------------------------------*/
100-
return topic?? throw new NullReferenceException("The specified Topic version could not be loaded");
100+
return topic?? throw new TopicNotFoundException(topicId);
101101

102102
}
103103

0 commit comments

Comments
 (0)