Skip to content

Commit 27e643e

Browse files
feat!: introduce explicit error handling (#3)
* feat: introduce explicit error handling Ref n0-computer/iroh#2741 * chore: remove unused dependency
1 parent 06fee28 commit 27e643e

File tree

6 files changed

+124
-187
lines changed

6 files changed

+124
-187
lines changed

Cargo.lock

+43-105
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }
2727
unused-async = "warn"
2828

2929
[dependencies]
30-
anyhow = { version = "1" }
3130
erased_set = "0.8"
3231
http-body-util = "0.1.0"
3332
hyper = { version = "1", features = ["server", "http1"] }
@@ -37,7 +36,7 @@ prometheus-client = { version = "0.22", optional = true }
3736
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
3837
serde = { version = "1", features = ["derive"] }
3938
struct_iterable = "0.1"
40-
time = { version = "0.3.21", features = ["serde-well-known"] }
39+
thiserror = "2.0.6"
4140
tokio = { version = "1", features = ["rt", "net", "fs"]}
4241
tracing = "0.1"
4342

src/core.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ impl Core {
177177
/// Encodes the current metrics registry to a string in
178178
/// the prometheus text exposition format.
179179
#[cfg(feature = "metrics")]
180-
pub fn encode(&self) -> Result<String, std::fmt::Error> {
180+
pub fn encode(&self) -> String {
181181
let mut buf = String::new();
182-
encode(&mut buf, &self.registry)?;
183-
Ok(buf)
182+
encode(&mut buf, &self.registry).expect("writing to string always works");
183+
buf
184184
}
185185
}
186186

0 commit comments

Comments
 (0)