1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum Error {
8 #[error("Unsupported type: {0}")]
10 UnsupportedType(String),
11
12 #[error("Invalid identifier: {0}")]
14 InvalidIdentifier(String),
15
16 #[error("Circular reference detected")]
18 CircularReference,
19
20 #[error("Generic constraint error: {0}")]
22 GenericConstraint(String),
23
24 #[error("IO error: {0}")]
26 Io(#[from] std::io::Error),
27
28 #[error("Configuration error: {0}")]
30 Configuration(String),
31
32 #[error("Format error: {message}: {source}")]
34 Format {
35 message: &'static str,
37 source: specta::FormatError,
39 },
40}
41
42impl Error {
43 pub(crate) fn format(message: &'static str, source: specta::FormatError) -> Self {
44 Self::Format { message, source }
45 }
46}