Skip to content

Commit

Permalink
Merge pull request #778 from LANCommander/throw-cancelled-exception
Browse files Browse the repository at this point in the history
Throw ReaderCancelledException on reader cancelled
  • Loading branch information
adamhathcock authored Nov 13, 2023
2 parents 632b83f + ed4099e commit 7d9c875
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/SharpCompress/Common/ReaderCancelledException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace SharpCompress.Common;

public class ReaderCancelledException : Exception

{
public ReaderCancelledException(string message)
: base(message) { }

public ReaderCancelledException(string message, Exception inner)
: base(message, inner) { }
}
2 changes: 1 addition & 1 deletion src/SharpCompress/Readers/AbstractReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public bool MoveToNextEntry()
}
if (Cancelled)
{
throw new InvalidOperationException("Reader has been cancelled.");
throw new ReaderCancelledException("Reader has been cancelled.");
}
if (entriesForCurrentReadStream is null)
{
Expand Down

0 comments on commit 7d9c875

Please sign in to comment.