1use thiserror::Error;
2use typeshare_model::{decorator, prelude::*};
3
4#[derive(Error, Debug)]
5pub enum FormatSpecialTypeError {
6 #[error("Unsupported special type: {0:?}")]
7 UnsupportedSpecialType(SpecialRustType),
8}
9
10#[derive(Error, Debug)]
11pub enum WriteDecoratorError {
12 #[error("Invalid annotation: {0:?}")]
13 InvalidAnnotation(decorator::Value),
14}
15
16#[derive(Error, Debug)]
17pub enum WriteEnumError {
18 #[error(
19 "Failed to generate Java type for {name:?}: A serializer must be specified to serialize algebraic enums"
20 )]
21 SerializerRequiredForAlgebraicEnums { name: String },
22 #[error("Unsupported enum variant: {0:?}")]
23 UnsupportedEnumVariant(RustEnumVariant),
24}
25
26#[derive(Error, Debug)]
27pub enum AssertJavaIdentifierError {
28 #[error("Invalid Java identifier ({name}): Invalid character ({char})")]
29 InvalidCharacter { name: String, char: char },
30 #[error("Invalid Java identifier: Empty string")]
31 EmptyString,
32}