mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Library-wise exception type #624
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fuzzah on GitHub (Apr 16, 2024).
Originally assigned to: @Copilot on GitHub.
Please consider declaring a common exception type for the library (like SharpCompressException) and inheriting all specific exception types from it instead of subclassing base Exception class in different places.
It would improve user experience, as now users need to
catch (Exception)which could mask actual errors such as hypothetical NullReferenceException in SharpCompress or exceptions thrown from some unrelated code residing in the same try block.@adamhathcock commented on GitHub (Apr 17, 2024):
Sounds good
@adamhathcock commented on GitHub (Apr 23, 2024):
Base exception:
SharpCompressExceptionfromApplicationExceptionNeed to see what other exceptions I define as there seem to be some specific ones but mostly using framework ones
@reima commented on GitHub (Apr 28, 2025):
Please be advised that custom exceptions should be derived from the
Exceptionclass, and not fromApplicationException(see remarks at https://learn.microsoft.com/en-us/dotnet/api/system.applicationexception?view=net-9.0).@adamhathcock commented on GitHub (Apr 28, 2025):
You're right. Not sure why I thought it was a good idea.
I also forgot the PR