live2d_parser/errors/
mod.rs1use std::{
2 error::Error,
3 fmt::{Debug, Display, Formatter},
4};
5
6#[derive(Debug)]
7pub enum L2Error {
8 OutOfBounds { rest: usize, request: usize },
9 UnknownType { type_id: u32 },
10 UnknownError {},
11}
12
13impl Error for L2Error {}
14
15impl Display for L2Error {
16 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
17 match self {
18 L2Error::OutOfBounds { rest, request } => {
19 f.write_str(&format!("Out of bounds: rest={}, request={}", rest, request))
20 }
21 L2Error::UnknownType { type_id } => f.write_str(&format!("Unknown type: type_id={}", type_id)),
22 L2Error::UnknownError {} => f.write_str(""),
23 }
24 }
25}