Skip to content

Commit

Permalink
replace quick-error with thiserror
Browse files Browse the repository at this point in the history
The reason is tailhook/quick-error#20
and DrawingAreaErrorKind<E> from plotters.

Why not error-chain: rust-lang-deprecated/error-chain#240
  • Loading branch information
vthriller committed Mar 8, 2020
1 parent 5716d9b commit 0b20e84
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
28 changes: 21 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ serde_qs = "0.5"
chrono = "0.4"
serde = { version = "1.0", features = ["derive"] }
hsluv = "0.1"
quick-error = "1.2"
thiserror = "1.0"
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#[macro_use] extern crate quick_error;
mod prom;
mod render;

Expand Down
18 changes: 7 additions & 11 deletions src/prom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,13 @@ struct PromMetric {
values: Vec<(f64, String)>,
}

quick_error! {
#[derive(Debug)]
pub enum Error {
Fetch(e: reqwest::Error) {
display("failed to fetch data: {}", e)
from()
}
Prom(e: String) {
display("failed to execute query: {}", e)
}
}

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("failed to fetch data: {0}")]
Fetch(#[from] reqwest::Error),
#[error("failed to execute query: {0}")]
Prom(String),
}

pub struct Metric {
Expand Down

0 comments on commit 0b20e84

Please sign in to comment.