Skip to main content

rosu_render/websocket/
error.rs

1use std::str::Utf8Error;
2
3use bytes::Bytes;
4use serde_json::Error as SerdeError;
5use thiserror::Error as ThisError;
6
7use crate::websocket::engineio::error::EngineIoError;
8
9#[derive(Debug, ThisError)]
10pub enum WebsocketError {
11    #[error("bot_auth authentication rejected: {message}")]
12    BotAuth { message: Box<str> },
13    #[error("Failed to deserialize data={data:?}")]
14    Deserialize {
15        #[source]
16        source: SerdeError,
17        data: Bytes,
18    },
19    #[error("engine.io error")]
20    EngineIo(#[from] EngineIoError),
21    #[error("The websocket packet contained an invalid o!rdr event payload=\"{0:?}\"")]
22    InvalidEvent(Bytes),
23    #[error("Invalid packet id {0}")]
24    InvalidPacketId(char),
25    #[error("Got an invalid packet which did not follow the protocol format")]
26    InvalidPacket,
27    #[error("Failed to decode binary as UTF-8")]
28    InvalidUtf8(#[from] Utf8Error),
29}