1use std::{error, fmt};
2
3#[derive(Debug, PartialEq)]
6pub enum Error {
7 InvalidMapKey,
9 InvalidInternallyTaggedEnum,
11 InvalidUsageOfSkip,
13}
14
15impl fmt::Display for Error {
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 match self {
18 Error::InvalidMapKey => writeln!(f, "A map key must be a 'string' or 'number' type"),
19 Error::InvalidInternallyTaggedEnum => writeln!(
20 f,
21 "#[specta(tag = \"...\")] cannot be used with tuple variants"
22 ),
23 Error::InvalidUsageOfSkip => writeln!(
24 f,
25 "the usage of #[specta(skip)] means the type can't be serialized"
26 ),
27 }
28 }
29}
30
31impl error::Error for Error {}