tmux-copyrat/src/error.rs

44 lines
929 B
Rust
Raw Normal View History

2021-10-24 09:33:55 +02:00
// use std::fmt;
2020-05-24 21:02:11 +02:00
2021-10-24 09:33:55 +02:00
#[derive(thiserror::Error, Debug)]
2021-10-24 18:28:58 +02:00
pub enum Error {
2021-10-24 09:33:55 +02:00
#[error("Expected 2 chars")]
2020-05-25 23:06:00 +02:00
ExpectedSurroundingPair,
2021-10-24 09:33:55 +02:00
#[error("Unknown alphabet")]
2020-05-25 23:06:00 +02:00
UnknownAlphabet,
2021-10-24 09:33:55 +02:00
#[error("Unknown ANSI color name: allowed values are magenta, cyan, black, ...")]
2020-05-25 23:06:00 +02:00
UnknownColor,
2021-10-24 09:33:55 +02:00
#[error("Unknown pattern name")]
UnknownPatternName,
2021-10-24 09:33:55 +02:00
#[error("Expected a pane id marker")]
2020-05-25 23:06:00 +02:00
ExpectedPaneIdMarker,
2020-05-24 21:02:11 +02:00
2021-10-24 09:33:55 +02:00
#[error("Failed parsing integer")]
ExpectedInt {
#[from]
source: std::num::ParseIntError,
},
2020-05-25 23:06:00 +02:00
2021-10-24 09:33:55 +02:00
#[error("Failed to parse bool")]
ExpectedBool {
#[from]
source: std::str::ParseBoolError,
},
2020-05-25 23:06:00 +02:00
2021-10-24 09:33:55 +02:00
#[error("Expected the string `{0}`")]
ExpectedString(String),
#[error("Expected the value to be within `{0}`")]
ExpectedEnumVariant(String),
2020-05-25 23:06:00 +02:00
2021-10-24 09:33:55 +02:00
#[error("IOError: `{source}`")]
Io {
#[from]
source: std::io::Error,
},
2020-05-24 21:02:11 +02:00
}