1use core::fmt;
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
7#[error("Error while deserializing ply: {0}")]
8pub struct DeserializeError(#[from] pub std::io::Error);
9
10#[derive(Error, Debug)]
12#[error("Error while serializing ply: {0}")]
13pub struct SerializeError(#[from] pub std::io::Error);
14
15impl serde::de::Error for DeserializeError {
16 fn custom<T: fmt::Display>(msg: T) -> Self {
17 DeserializeError(std::io::Error::new(
18 std::io::ErrorKind::InvalidData,
19 msg.to_string(),
20 ))
21 }
22}
23
24impl serde::ser::Error for SerializeError {
25 fn custom<T: fmt::Display>(msg: T) -> Self {
26 SerializeError(std::io::Error::new(
27 std::io::ErrorKind::InvalidData,
28 msg.to_string(),
29 ))
30 }
31}