Skip to content

Add generic decoding exception classes#248

Merged
piksel merged 1 commit into
icsharpcode:masterfrom
piksel:generic-exceptions
Jul 18, 2018
Merged

Add generic decoding exception classes#248
piksel merged 1 commit into
icsharpcode:masterfrom
piksel:generic-exceptions

Conversation

@piksel

@piksel piksel commented Jul 15, 2018

Copy link
Copy Markdown
Member

This will add exceptions to be thrown when an invalid state is reached during decoding of input streams.

StreamDecodingException is the main exception that the others inherit from and provides a way to signal that the input stream cannot be decoded by the library, either because of some bug or (unintentional) incompability or because of corrupted input data.

This is currently being handled very inconsistently in the library and sometimes not at all, leading to infinite loops and unexpected behaviour.

If the error is because of unimplemented or unsupported behaviour in the library, StreamUnsupportedException should be used instead. It is basically just a NotImplementedException derived from SharpZipBaseException.

UnexpectedEndOfStreamException should be used to indicate when no actual problem with the input data was found but more data was needed to complete the decoding. This could be a useful differentiation for consumers.

ValueOutOfRangeException is just a helper for easier formatting of a common failure.

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@piksel piksel changed the title Add some generic decoding exception classes Add generic decoding exception classes Jul 15, 2018
@piksel piksel added core ready PR ready for merging when appropriate labels Jul 15, 2018
@piksel piksel merged commit 28e14cc into icsharpcode:master Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core ready PR ready for merging when appropriate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant