pub enum Error {
Io(Error),
Parse(String),
TreeSitter(String),
FileNotFound(PathBuf),
DirectoryNotFound(PathBuf),
InvalidConfig(String),
UnsupportedLanguage(String),
}
Expand description
Error types for the CodeBank library.
This enum represents all possible errors that can occur in the CodeBank library.
§Examples
use codebank::Error;
use std::path::PathBuf;
// Create an IO error
let io_err = std::io::Error::new(std::io::ErrorKind::NotFound, "file not found");
let error = Error::Io(io_err);
assert!(matches!(error, Error::Io(_)));
// Create a parse error
let error = Error::Parse("invalid syntax".to_string());
assert!(matches!(error, Error::Parse(_)));
// Create a file not found error
let error = Error::FileNotFound(PathBuf::from("missing.rs"));
assert!(matches!(error, Error::FileNotFound(_)));
Variants§
Io(Error)
IO error wrapper
Parse(String)
Parse error for syntax parsing failures
TreeSitter(String)
Tree-sitter error for tree-sitter specific failures
FileNotFound(PathBuf)
File not found error
DirectoryNotFound(PathBuf)
Directory not found error
InvalidConfig(String)
Invalid configuration error
UnsupportedLanguage(String)
Unsupported language error
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more