--- source_files: - Common/DTS.Common/Classes/Connection/NotConnectedException.cs generated_at: "2026-04-16T03:14:45.601567+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "e5ae1dc6ac386b41" --- # Connection 1. **Purpose** This module defines a custom exception type, `NotConnectedException`, used to signal operations that are attempted on a connection object when no active connection exists. It serves as a domain-specific error mechanism within the `DTS.Common` library to distinguish connection-state errors from generic application failures, enabling callers to handle disconnection scenarios explicitly. 2. **Public Interface** - **`NotConnectedException(string message)`** Constructor that initializes a new instance of the exception with a specified error message. Inherits from `ApplicationException`. No additional properties or methods are defined beyond those inherited from `Exception`. 3. **Invariants** - The exception must always be instantiated with a non-null `message` parameter (enforced by the base `ApplicationException` constructor). - It is a *terminal* exception type—no subclasses or derived types are defined in the provided source. - No state beyond the exception message (inherited from `Exception.Message`) is stored or managed. 4. **Dependencies** - **Depends on**: `System` namespace (specifically `System.ApplicationException`). - **Used by**: Other modules in the `DTS.Common` namespace (and potentially downstream projects) that manage connection lifecycles and need to throw or catch connection-state errors. - No external project or library dependencies beyond the .NET Framework base class library. 5. **Gotchas** - The class inherits from `ApplicationException`, which is generally discouraged in modern .NET development in favor of `Exception` or more specific base types; this may reflect legacy design. - No inner exception overload is provided—callers cannot wrap another exception as the cause. - No additional context (e.g., connection ID, endpoint) is captured; callers must embed such details in the `message` string. - None identified from source alone.