tiempo-rs/src/error.rs

34 lines
889 B
Rust
Raw Normal View History

2021-06-18 11:27:19 -05:00
use std::result;
use std::path::PathBuf;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("The command '{0}' is not implemented")]
UnimplementedCommand(String),
#[error("Sqlite error: {0}")]
Sqlite(#[from] rusqlite::Error),
#[error("Could not find home directory :(")]
NoHomeDir,
#[error("The file {0} was not found")]
FileNotFound(PathBuf),
#[error("Error reading the file: {0}")]
CouldntRead(PathBuf),
#[error("Couldn't parse toml file at: {path}\nwith error: {error}")]
TomlError{ path: PathBuf, error: toml::de::Error},
#[error("Couldn't parse yaml file at: {path}\nwith error: {error}")]
YamlError{ path: PathBuf, error: serde_yaml::Error},
2021-06-21 11:12:30 -05:00
#[error("Could not parse datetime: {0}")]
DateTimeParseError(#[from] chrono::format::ParseError),
2021-06-18 11:27:19 -05:00
}
pub type Result<T> = result::Result<T, Error>;