1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
use crate::PacketError;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("No stream found for port '{0}'")]
PortMissing(String),
#[error("Error serializing or deserializing payload: {0}")]
Codec(String),
#[error("Error communicating over a stream or channel: {0}")]
Channel(String),
#[error("{0}")]
General(String),
#[error("{}", .0.msg())]
PayloadError(PacketError),
#[error("Got a Done signal in an unexpected context.")]
UnexpectedDone,
}
impl From<wasmrs_codec::error::Error> for Error {
fn from(value: wasmrs_codec::error::Error) -> Self {
Self::Codec(value.to_string())
}
}
impl From<wasmrs_rx::Error> for Error {
fn from(value: wasmrs_rx::Error) -> Self {
Self::Channel(value.to_string())
}
}
impl From<Box<dyn std::error::Error>> for Error {
fn from(value: Box<dyn std::error::Error>) -> Self {
Self::General(value.to_string())
}
}
#[derive(thiserror::Error, Debug, Clone)]
pub enum ParseError {
#[error("Invalid scheme {0}")]
Scheme(String),
#[error("Missing authority/host")]
Authority,
#[error("Invalid authority/host '{0}', missing separator '.'")]
InvalidAuthority(String),
#[error("Invalid authority/host kind '{0}'")]
InvalidAuthorityKind(String),
#[error("{0}")]
Parse(url::ParseError),
}