skrillax_serde/
error.rs

1use std::io;
2use std::string::{FromUtf16Error, FromUtf8Error};
3use thiserror::Error;
4
5/// Any kind of problem that may occur when trying to deserialize data.
6#[derive(Error, Debug)]
7pub enum SerializationError {
8    #[error("I/O error when serialize/deserializing packet")]
9    IoError(#[from] io::Error),
10    #[error("The enum {1} does not have a variation for value {0}")]
11    UnknownVariation(usize, &'static str),
12    #[error("Could not convert bytes to a string")]
13    StringParsingFailed(#[from] FromUtf8Error),
14    #[error("Could not convert bytes to a utf16 string")]
15    Utf16ParsingFailed(#[from] FromUtf16Error),
16}