use thiserror::Error;
#[derive(Error, Debug)]
#[error(transparent)]
#[non_exhaustive]
pub enum ApiError {
#[error("An error occurred while trying to communicate with the Ring OAuth API")]
RequestError(#[from] reqwest::Error),
#[error("An error occurred while decoding the response from the Ring API: {0}")]
InvalidResponse(#[from] serde_json::Error),
#[error("An error occurred while trying to communicate with the Ring API: {0}")]
WebsocketError(#[from] tokio_tungstenite::tungstenite::Error),
#[error("An error occurred while trying to refresh the authentication tokens")]
AuthenticationRefreshFailed(crate::client::authentication::AuthenticationError),
#[error("An error occurred while sending a message")]
SinkAlreadyClosed,
}