Class CompressionException
The exclusive exception type thrown by ScyllaCompression and the ICompressionProvider / IArchiveProvider implementations when a compression or decompression operation cannot complete successfully.
Implements
Inherited Members
Namespace: Scylla.Core.Util.Compression
Assembly: ScyllaCore.dll
Syntax
public class CompressionException : Exception, ISerializable
Remarks
Every failure path in ScyllaCompression either throws a
CompressionException directly or wraps an underlying system exception (such as
IOException or UnauthorizedAccessException) inside one. Callers can
therefore use a single catch (CompressionException) block to handle all
compression-related failures.
The ErrorCode property identifies the category of failure, enabling structured error handling without string parsing. For example, a caller can distinguish a wrong password (WrongPassword) from a missing file (FileNotFound) and take different recovery actions.
As an alternative to catching exceptions, most ScyllaCompression operations also offer result-returning variants that return a CompressionResult or CompressionResult<T> and never throw, which can simplify control flow in async contexts.
Constructors
CompressionException(CompressionErrorCode)
Initializes a new CompressionException with a structured error code.
The Message is automatically derived from the code via
GetDefaultMessage.
Declaration
public CompressionException(CompressionErrorCode errorCode)
Parameters
| Type | Name | Description |
|---|---|---|
| CompressionErrorCode | errorCode | The error code that categorizes this failure. This value is stored in ErrorCode and is also used to generate the exception message. |
CompressionException(CompressionErrorCode, string)
Initializes a new CompressionException with a structured error code and an explicit, caller-supplied message that provides more specific context than the default code-derived message.
Declaration
public CompressionException(CompressionErrorCode errorCode, string message)
Parameters
| Type | Name | Description |
|---|---|---|
| CompressionErrorCode | errorCode | The error code that categorizes this failure. Stored in ErrorCode. |
| string | message | A human-readable description of the specific failure condition. Used verbatim as Message; a default message is NOT generated when this overload is used. |
CompressionException(CompressionErrorCode, string, Exception)
Initializes a new CompressionException that wraps an underlying exception thrown by a lower-level I/O or library call.
Declaration
public CompressionException(CompressionErrorCode errorCode, string message, Exception innerException)
Parameters
| Type | Name | Description |
|---|---|---|
| CompressionErrorCode | errorCode | The error code that categorizes this failure. Stored in ErrorCode. |
| string | message | A human-readable description of the specific failure condition, typically including the file path or operation name for context. |
| Exception | innerException | The original exception from the underlying I/O or compression library that triggered this failure. Accessible via InnerException and preserved for full stack-trace diagnostics. |
Properties
ErrorCode
Gets the structured error code that categorizes the kind of compression failure that occurred. Use this property for programmatic error handling instead of parsing the exception message string.
Declaration
public CompressionErrorCode ErrorCode { get; }
Property Value
| Type | Description |
|---|---|
| CompressionErrorCode | A CompressionErrorCode value describing the failure. See the individual enum members for descriptions of each failure category and recommended recovery actions. |