Module error_chain

Module error_chain 

Source
Expand description

Error chain utilities Copyright © 2025-2026 Wenze Wei. All Rights Reserved.

This file is part of DMSC. The DMSC project belongs to the Dunimd Team.

Licensed under the Apache License, Version 2.0 (the “License”); You may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

§Error Chain Support

This module provides enhanced error handling with error chain support, allowing errors to be wrapped with additional context while preserving the original error. This is particularly useful for debugging and error reporting in complex distributed systems.

§Key Features

  • Error Chaining: Wrap errors with additional context
  • Error Context: Add contextual information to errors
  • Error Traversal: Walk through the error chain
  • Pretty Printing: Format error chains for better readability
  • Backtrace Support: Optional backtrace capture for debugging

§Usage Examples

use dmsc::core::error_chain::{DMSCErrorChain, DMSCErrorContext};

let result = some_operation()
    .map_err(|e| DMSCErrorChain::new(e).context("Failed to perform operation"));

Modules§

utils
Utility functions for error chain operations.

Structs§

DMSCErrorChain
A chain of errors with contextual information.
DMSCErrorChainIter
Iterator over the error chain.

Traits§

DMSCErrorContext
Trait for adding error chain functionality to Result types.
DMSCOptionErrorContext
Extension trait for adding error context to Option types.