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. \
19     They are mutually exclusive."
20  )]
21  MutuallyExclusiveBackends,
22  #[error(
23    "No syntax highlighting backend available. Enable either 'syntastica' or \
24     'syntect' feature."
25  )]
26  NoBackendAvailable,
27}