1pub type Result<T, E = Error> = std::result::Result<T, E>;
2
3#[derive(thiserror::Error, Debug)]
4pub enum Error {
5 #[error("Build error: {0}")]
6 Build(String),
7
8 #[error("bindings config is required when python, node, or node_ts output is enabled")]
9 MissingBindingsConfig,
10
11 #[error("Missing annotation for {object}: {message}")]
12 MissingAnnotation { object: String, message: String },
13
14 #[error("Invalid annotation for {object}: {message}")]
15 InvalidAnnotation { object: String, message: String },
16
17 #[error("Invalid models_path template `{template}`: {source}")]
18 InvalidModelsPathTemplate {
19 template: String,
20 #[source]
21 source: syn::Error,
22 },
23
24 #[error("Invalid Rust path `{path}` derived from proto message `{message}`: {source}")]
25 InvalidRustPath {
26 path: String,
27 message: String,
28 #[source]
29 source: syn::Error,
30 },
31
32 #[error("Invalid error_type_path `{path}`: {source}")]
33 InvalidErrorTypePath {
34 path: String,
35 #[source]
36 source: syn::Error,
37 },
38
39 #[error("Invalid {field} `{path}`: {source}")]
40 InvalidConfigPath {
41 field: &'static str,
42 path: String,
43 #[source]
44 source: syn::Error,
45 },
46
47 #[error(
48 "Failed to parse generated tokens as a Rust file: {source}\n--- generated tokens ---\n{tokens}"
49 )]
50 GeneratedParse {
51 tokens: String,
52 #[source]
53 source: syn::Error,
54 },
55
56 #[error("IO error: {0}")]
57 Io(#[from] std::io::Error),
58}