1use runtara_protocol::ClientError;
6use thiserror::Error;
7
8#[derive(Debug, Error)]
10pub enum SdkError {
11 #[error("configuration error: {0}")]
13 Config(String),
14
15 #[error("connection error: {0}")]
17 Connection(#[from] ClientError),
18
19 #[error("registration failed: {0}")]
21 Registration(String),
22
23 #[error("checkpoint error: {0}")]
25 Checkpoint(String),
26
27 #[error("sleep error: {0}")]
29 Sleep(String),
30
31 #[error("event error: {0}")]
33 Event(String),
34
35 #[error("signal error: {0}")]
37 Signal(String),
38
39 #[error("status error: {0}")]
41 Status(String),
42
43 #[error("server error: {code} - {message}")]
45 Server {
46 code: String,
48 message: String,
50 },
51
52 #[error("instance cancelled")]
54 Cancelled,
55
56 #[error("instance paused")]
58 Paused,
59
60 #[error("serialization error: {0}")]
62 Serialization(String),
63
64 #[error("unexpected response: {0}")]
66 UnexpectedResponse(String),
67}
68
69impl From<prost::DecodeError> for SdkError {
70 fn from(err: prost::DecodeError) -> Self {
71 SdkError::Serialization(err.to_string())
72 }
73}
74
75pub type Result<T> = std::result::Result<T, SdkError>;