Skip to content
Merged
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
19 changes: 14 additions & 5 deletions src/ReactiveDomain.Foundation/StreamStore/StreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ public virtual bool Read(
Ensure.Nonnegative((long)checkpoint, nameof(checkpoint));
if (count != null)
Ensure.Positive((long)count, nameof(count));
if (!ValidateStreamName(streamName))
throw new ArgumentException("Stream not found.", streamName);

if (!ValidateStreamName(streamName))
return false;
_cancelled = false;
FirstEventRead = false;
StreamName = streamName;
Expand Down Expand Up @@ -191,8 +191,17 @@ public virtual bool Read(
/// <param name="streamName">The stream name to validate.</param>
public bool ValidateStreamName(string streamName)
{
var currentSlice = _streamStoreConnection.ReadStreamForward(streamName, 0, 1);
return !(currentSlice is StreamDeletedSlice);
try
{
var result = _streamStoreConnection.ReadStreamForward(streamName, 0, 1);

return result.GetType() == typeof(StreamEventsSlice);
}
catch (Exception)
{
return false;
}

}

protected virtual void EventRead(RecordedEvent recordedEvent)
Expand Down
Loading