pub enum BatlessError {
Show 13 variants
FileNotFound {
path: String,
suggestions: Vec<String>,
},
FileReadError {
path: String,
source: Error,
},
PermissionDenied {
path: String,
help: String,
},
HighlightError {
message: String,
operation: String,
source_error: Option<String>,
},
ThemeNotFound {
theme: String,
suggestions: Vec<String>,
},
LanguageNotFound {
language: String,
suggestions: Vec<String>,
},
LanguageDetectionError {
path: String,
details: String,
},
EncodingError {
path: String,
details: String,
},
ProcessingError {
message: String,
path: Option<String>,
help: Option<String>,
},
ConfigurationError {
message: String,
help: Option<String>,
},
JsonSerializationError(Error),
OutputError(String),
IoError(Error),
}Expand description
Main error type for batless operations
Variants§
FileNotFound
File system related errors
FileReadError
PermissionDenied
HighlightError
Syntax highlighting errors
ThemeNotFound
LanguageNotFound
LanguageDetectionError
EncodingError
Processing errors
ProcessingError
ConfigurationError
JsonSerializationError(Error)
Output formatting errors
OutputError(String)
IoError(Error)
Generic I/O errors
Implementations§
Source§impl BatlessError
impl BatlessError
Sourcepub fn error_code(&self) -> ErrorCode
pub fn error_code(&self) -> ErrorCode
Get the error code for this error
Sourcepub fn file_not_found_with_suggestions(path: String) -> Self
pub fn file_not_found_with_suggestions(path: String) -> Self
Create a FileNotFound error with file suggestions
Sourcepub fn theme_not_found_with_suggestions(
theme: String,
available_themes: &[String],
) -> Self
pub fn theme_not_found_with_suggestions( theme: String, available_themes: &[String], ) -> Self
Create a ThemeNotFound error with theme suggestions
Sourcepub fn language_not_found_with_suggestions(
language: String,
available_languages: &[String],
) -> Self
pub fn language_not_found_with_suggestions( language: String, available_languages: &[String], ) -> Self
Create a LanguageNotFound error with language suggestions
Sourcepub fn permission_denied_with_help(path: String) -> Self
pub fn permission_denied_with_help(path: String) -> Self
Create a PermissionDenied error with helpful suggestions
Sourcepub fn config_error_with_help(message: String, help: Option<String>) -> Self
pub fn config_error_with_help(message: String, help: Option<String>) -> Self
Create a ConfigurationError with helpful suggestions
Sourcepub fn highlight_error(
message: impl Into<String>,
operation: impl Into<String>,
) -> Self
pub fn highlight_error( message: impl Into<String>, operation: impl Into<String>, ) -> Self
Create a HighlightError with context about what operation failed
Sourcepub fn highlight_error_with_source(
message: impl Into<String>,
operation: impl Into<String>,
source: impl Display,
) -> Self
pub fn highlight_error_with_source( message: impl Into<String>, operation: impl Into<String>, source: impl Display, ) -> Self
Create a HighlightError with source error information
Sourcepub fn language_detection_error(
path: impl Into<String>,
details: impl Into<String>,
) -> Self
pub fn language_detection_error( path: impl Into<String>, details: impl Into<String>, ) -> Self
Create a LanguageDetectionError with file path context
Sourcepub fn processing_error(message: impl Into<String>) -> Self
pub fn processing_error(message: impl Into<String>) -> Self
Create a ProcessingError with context
Sourcepub fn processing_error_for_path(
path: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn processing_error_for_path( path: impl Into<String>, message: impl Into<String>, ) -> Self
Create a ProcessingError with file path context
Sourcepub fn processing_error_with_help(
path: Option<String>,
message: impl Into<String>,
help: impl Into<String>,
) -> Self
pub fn processing_error_with_help( path: Option<String>, message: impl Into<String>, help: impl Into<String>, ) -> Self
Create a ProcessingError with full context
Sourcepub fn encoding_error(
path: impl Into<String>,
details: impl Into<String>,
) -> Self
pub fn encoding_error( path: impl Into<String>, details: impl Into<String>, ) -> Self
Create an EncodingError for a file
Sourcepub fn from_io_error(err: Error, path: impl Into<String>) -> Self
pub fn from_io_error(err: Error, path: impl Into<String>) -> Self
Create appropriate error from an IO error with file context
This examines the IO error kind to return the most specific error type:
- NotFound -> FileNotFound with suggestions
- PermissionDenied -> PermissionDenied with help
- Other -> FileReadError with source
Trait Implementations§
Source§impl Debug for BatlessError
impl Debug for BatlessError
Source§impl Display for BatlessError
impl Display for BatlessError
Source§impl Error for BatlessError
impl Error for BatlessError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()