jetstream_error/
extensions.rs1#[cfg(all(feature = "s2n-quic", not(target_os = "windows")))]
2impl From<s2n_quic::provider::tls::default::error::Error> for crate::Error {
3 fn from(value: s2n_quic::provider::tls::default::error::Error) -> Self {
4 crate::Error::from(
5 miette::MietteDiagnostic::new(value.to_string())
6 .with_code("jetstream::s2n_quic::tls_error"),
7 )
8 }
9}
10
11#[cfg(feature = "s2n-quic")]
12impl From<s2n_quic::connection::Error> for crate::Error {
13 fn from(value: s2n_quic::connection::Error) -> Self {
14 crate::Error::from(
15 miette::MietteDiagnostic::new(value.to_string())
16 .with_code("jetstream::s2n_quic::connection_error"),
17 )
18 }
19}
20
21#[cfg(feature = "s2n-quic")]
22impl From<s2n_quic::provider::StartError> for crate::Error {
23 fn from(value: s2n_quic::provider::StartError) -> Self {
24 crate::Error::from(
25 miette::MietteDiagnostic::new(value.to_string())
26 .with_code("jetstream::s2n_quic::start_error"),
27 )
28 }
29}
30
31#[cfg(feature = "iroh")]
32impl From<iroh::endpoint::ConnectionError> for crate::Error {
33 fn from(value: iroh::endpoint::ConnectionError) -> Self {
34 crate::Error::from(
35 miette::MietteDiagnostic::new(value.to_string())
36 .with_code("jetstream::iroh::connection_error"),
37 )
38 }
39}
40
41#[cfg(feature = "worker")]
42impl From<worker::Error> for crate::Error {
43 fn from(value: worker::Error) -> Self {
44 crate::Error::from(
45 miette::MietteDiagnostic::new(value.to_string())
46 .with_code("jetstream::worker::error"),
47 )
48 }
49}
50
51impl From<std::convert::Infallible> for crate::Error {
52 fn from(value: std::convert::Infallible) -> Self {
53 match value {}
54 }
55}
56
57impl From<std::net::AddrParseError> for crate::Error {
58 fn from(value: std::net::AddrParseError) -> Self {
59 crate::Error::from(
60 miette::MietteDiagnostic::new(value.to_string())
61 .with_code("jetstream::addr_parse_error"),
62 )
63 }
64}