Skip to content

Commit

Permalink
Fix exception type and improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Jul 16, 2024
1 parent 6af01ce commit f4fe28d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Bonsai.Core/Reactive/Slice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ public override IObservable<TSource> Process<TSource>(IObservable<TSource> sourc
var start = Start;
if (start < 0)
{
throw new ArgumentOutOfRangeException(nameof(start));
throw new InvalidOperationException("The specified start index is less than zero.");
}

var step = Step;
if (step <= 0)
{
throw new ArgumentOutOfRangeException(nameof(step));
throw new InvalidOperationException("Step size must be a positive number.");
}

var stop = Stop;
if (stop < 0)
{
throw new ArgumentOutOfRangeException(nameof(stop));
throw new InvalidOperationException("The specified stop index is less than zero.");
}

return (stop - start) <= 0 ? Observable.Empty<TSource>() : Observable.Create<TSource>(observer =>
Expand Down

0 comments on commit f4fe28d

Please sign in to comment.