leo_errors/errors/ast/
ast_errors.rs1use crate::create_messages;
18use std::{
19 error::Error as ErrorArg,
20 fmt::{Debug, Display},
21};
22
23create_messages!(
24 AstError,
26 code_mask: 2000i32,
27 code_prefix: "AST",
28
29 @backtraced
31 failed_to_convert_ast_to_json_string {
32 args: (error: impl ErrorArg),
33 msg: format!("failed to convert ast to a json string {error}"),
34 help: None,
35 }
36
37 @backtraced
39 failed_to_create_ast_json_file {
40 args: (path: impl Debug, error: impl ErrorArg),
41 msg: format!("failed to create ast json file `{path:?}` {error}"),
42 help: None,
43 }
44
45 @backtraced
47 failed_to_write_ast_to_json_file {
48 args: (path: impl Debug, error: impl ErrorArg),
49 msg: format!("failed to write ast to a json file `{path:?}` {error}"),
50 help: None,
51 }
52
53 @backtraced
55 failed_to_read_json_string_to_ast {
56 args: (error: impl ErrorArg),
57 msg: format!("failed to convert json string to an ast {error}"),
58 help: None,
59 }
60
61 @backtraced
63 failed_to_read_json_file {
64 args: (path: impl Debug, error: impl ErrorArg),
65 msg: format!("failed to convert json file `{path:?}` to an ast {error}"),
66 help: None,
67 }
68
69 @backtraced
71 failed_to_convert_ast_to_json_value {
72 args: (error: impl ErrorArg),
73 msg: format!("failed to convert ast to a json value {error}"),
74 help: None,
75 }
76
77 @formatted
79 shadowed_function {
80 args: (func: impl Display),
81 msg: format!("function `{func}` shadowed by"),
82 help: None,
83 }
84
85 @formatted
87 shadowed_struct {
88 args: (struct_: impl Display),
89 msg: format!("struct `{struct_}` shadowed by"),
90 help: None,
91 }
92
93 @formatted
95 shadowed_record {
96 args: (record: impl Display),
97 msg: format!("record `{record}` shadowed by"),
98 help: None,
99 }
100
101 @formatted
103 shadowed_variable {
104 args: (var: impl Display),
105 msg: format!("variable `{var}` shadowed by"),
106 help: None,
107 }
108
109 @backtraced
111 failed_to_convert_symbol_table_to_json_string {
112 args: (error: impl ErrorArg),
113 msg: format!("failed to convert symbol_table to a json string {error}"),
114 help: None,
115 }
116
117 @backtraced
119 failed_to_create_symbol_table_json_file {
120 args: (path: impl Debug, error: impl ErrorArg),
121 msg: format!("failed to create symbol_table json file `{path:?}` {error}"),
122 help: None,
123 }
124
125 @backtraced
127 failed_to_write_symbol_table_to_json_file {
128 args: (path: impl Debug, error: impl ErrorArg),
129 msg: format!("failed to write symbol_table to a json file `{path:?}` {error}"),
130 help: None,
131 }
132
133 @backtraced
135 failed_to_read_json_string_to_symbol_table {
136 args: (error: impl ErrorArg),
137 msg: format!("failed to convert json string to an symbol_table {error}"),
138 help: None,
139 }
140
141 @backtraced
143 failed_to_convert_symbol_table_to_json_value {
144 args: (error: impl ErrorArg),
145 msg: format!("failed to convert symbol_table to a json value {error}"),
146 help: None,
147 }
148
149 @formatted
150 redefining_external_struct {
151 args: (struct_: impl Display),
152 msg: format!("There are two definitions of struct `{struct_}` that do not match."),
153 help: Some("Check the import files to see if there are any struct definitions of the same name.".to_string()),
154 }
155
156 @backtraced
157 function_not_found {
158 args: (func: impl Display),
159 msg: format!("function `{func}` not found"),
160 help: None,
161 }
162);