1#[derive(Debug, thiserror::Error)]
5#[repr(u8)]
6pub enum ServiceError {
7 #[error("Authentication failed")]
9 AuthenticationFailed = 41, #[error("Resource not found")]
12 ResourceNotFound = 44, #[error("Invalid service ID: {0}")]
15 InvalidServiceId(u8) = 40, #[error("Unknown service")]
19 UnknownService = 51, #[error("Service unavailable")]
22 ServiceUnavailable = 52, }
24
25impl ServiceError {
26 pub fn as_u8(&self) -> u8 {
28 match self {
29 ServiceError::InvalidServiceId(_) => 40,
30 ServiceError::AuthenticationFailed => 41,
31 ServiceError::ResourceNotFound => 44,
32 ServiceError::UnknownService => 51,
33 ServiceError::ServiceUnavailable => 52,
34 }
35 }
36}