yang_base/definition/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Clone, PartialEq, Eq, Error)]
7#[non_exhaustive]
8pub enum BuildError {
9 #[error("{kind} 名称非法: {name}")]
11 InvalidName {
12 kind: &'static str,
14 name: String,
16 },
17 #[error("{kind} 名称重复: {name}")]
19 DuplicateName {
20 kind: &'static str,
22 name: String,
24 },
25 #[error("{kind} 引用无效: {reference}")]
27 InvalidReference {
28 kind: &'static str,
30 reference: String,
32 },
33 #[error("route 冲突: {method} {path}{detail}")]
35 RouteConflict {
36 method: String,
38 path: String,
40 detail: String,
42 },
43 #[error("route 非法: {method} {path}: {reason}")]
45 InvalidRoute {
46 method: String,
48 path: String,
50 reason: String,
52 },
53 #[error("字段定义非法 [{table}.{field}]: {reason}")]
55 InvalidFieldDefinition {
56 table: String,
58 field: String,
60 reason: String,
62 },
63 #[error("Addon 依赖缺失 [{addon}]: {dependency}")]
65 DependencyMissing {
66 addon: String,
68 dependency: String,
70 },
71}