Finished basic google home implementation with some slight refactors along the way

This commit is contained in:
2022-12-16 06:54:31 +01:00
parent 995ff08784
commit e88e2fe48b
23 changed files with 551 additions and 208 deletions

View File

@@ -1,7 +1,37 @@
use thiserror::Error;
use serde::Serialize;
#[derive(Debug, Serialize)]
#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone, Serialize, Error)]
#[serde(rename_all = "camelCase")]
pub enum Errors {
DeviceNotFound
pub enum DeviceError {
#[error("deviceNotFound")]
DeviceNotFound,
#[error("actionNotAvailable")]
ActionNotAvailable,
}
#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone, Serialize, Error)]
#[serde(rename_all = "camelCase")]
pub enum DeviceException {
}
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy, Serialize, Error)]
#[serde(untagged)]
pub enum ErrorCode {
#[error("{0}")]
DeviceError(DeviceError),
#[error("{0}")]
DeviceException(DeviceException),
}
impl From<DeviceError> for ErrorCode {
fn from(value: DeviceError) -> Self {
Self::DeviceError(value)
}
}
impl From<DeviceException> for ErrorCode {
fn from(value: DeviceException) -> Self {
Self::DeviceException(value)
}
}