ndg_commonmark/syntax/
error.rs

1//! Error types for syntax highlighting operations.
2
3/// Result type for syntax highlighting operations.
4pub type SyntaxResult<T> = Result<T, SyntaxError>;
5
6/// Errors that can occur during syntax highlighting.
7#[derive(Debug, thiserror::Error)]
8pub enum SyntaxError {
9    #[error("Language '{0}' is not supported by this highlighter")]
10    UnsupportedLanguage(String),
11    #[error("Theme '{0}' is not available")]
12    ThemeNotFound(String),
13    #[error("Highlighting failed: {0}")]
14    HighlightingFailed(String),
15    #[error("Backend initialization failed: {0}")]
16    BackendError(String),
17    #[error(
18        "Cannot enable both 'syntastica' and 'syntect' features simultaneously. They are mutually exclusive."
19    )]
20    MutuallyExclusiveBackends,
21    #[error(
22        "No syntax highlighting backend available. Enable either 'syntastica' or 'syntect' feature."
23    )]
24    NoBackendAvailable,
25}