1use thiserror::Error;
2
3use crate::namespace::media::ErrorReason;
4
5use super::Response;
6
7#[derive(Error, Debug)]
8pub enum Error {
9 #[error("Input/Output error: {0}")]
10 Io(#[from] std::io::Error),
11
12 #[error("Input/Output error: {0}")]
13 AddrParseError(#[from] std::net::AddrParseError),
14
15 #[error("TLS error: {0}")]
16 Tls(#[from] async_native_tls::Error),
17
18 #[error("Decode error: {0}")]
19 Decode(#[from] prost::DecodeError),
20
21 #[error("Deserialize error: {0}")]
22 Deserialize(#[from] serde_json::Error),
23
24 #[error("Receive error: {0}")]
25 Receive(#[from] async_channel::RecvError),
26
27 #[error("Send error: {0}")]
28 Send(#[from] Box<async_channel::SendError<Response>>),
29
30 #[error("Did not receive request response")]
31 ResponseTimeout,
32
33 #[error("Not connected with receiver")]
34 NoConnection,
35
36 #[error("Unable to launch app: {0}")]
37 LaunchError(String),
38
39 #[error("Unsupported Namespace")]
40 UnsupportedNamespace,
41
42 #[error("Media Channel Error: {0}")]
43 MediaError(MediaError),
44
45 #[error("Did not receive a matching response")]
46 NoResponse,
47}
48
49#[derive(Error, Debug)]
50pub enum MediaError {
51 #[error("Invalid Request")]
52 InvalidRequest(ErrorReason),
53
54 #[error("Invalid Player State")]
55 InvalidPlayerState,
56
57 #[error("Load Failed")]
58 LoadFailed,
59
60 #[error("Load Cancelled")]
61 LoadCancelled,
62}