fast_yaml_parallel/
error.rs

1//! Error types for parallel processing operations.
2
3use fast_yaml_core::ParseError;
4use thiserror::Error;
5
6/// Errors that can occur during parallel processing.
7#[derive(Error, Debug)]
8pub enum ParallelError {
9    /// Failed to parse a document at specific index.
10    ///
11    /// Preserves document index for debugging multi-document streams.
12    #[error("failed to parse document at index {index}")]
13    ParseError {
14        /// Zero-based index of the document that failed.
15        index: usize,
16
17        /// The underlying parse error from fast-yaml-core.
18        #[source]
19        source: ParseError,
20    },
21
22    /// Document chunking failed (e.g., malformed separators).
23    #[error("chunking failed: {0}")]
24    ChunkingError(String),
25
26    /// Thread pool initialization failed.
27    #[error("thread pool error: {0}")]
28    ThreadPoolError(String),
29
30    /// Configuration error (invalid parameters).
31    #[error("invalid configuration: {0}")]
32    ConfigError(String),
33}
34
35/// Result type for parallel operations.
36pub type Result<T> = std::result::Result<T, ParallelError>;