• Home
  • Raw
  • Download

Lines Matching full:error

2 use thiserror::Error;
10 #[derive(Error, Debug)] in test_braced()
11 #[error("braced error: {msg}")] in test_braced()
12 struct Error { in test_braced() struct
17 assert("braced error: T", Error { msg }); in test_braced()
22 #[derive(Error, Debug)] in test_braced_unused()
23 #[error("braced error")] in test_braced_unused()
24 struct Error { in test_braced_unused() struct
28 assert("braced error", Error { extra: 0 }); in test_braced_unused()
33 #[derive(Error, Debug)] in test_tuple()
34 #[error("tuple error: {0}")] in test_tuple()
35 struct Error(usize); in test_tuple() struct
37 assert("tuple error: 0", Error(0)); in test_tuple()
42 #[derive(Error, Debug)] in test_unit()
43 #[error("unit error")] in test_unit()
44 struct Error; in test_unit() struct
46 assert("unit error", Error); in test_unit()
51 #[derive(Error, Debug)] in test_enum()
52 enum Error { in test_enum() enum
53 #[error("braced error: {id}")] in test_enum()
55 #[error("tuple error: {0}")] in test_enum()
57 #[error("unit error")] in test_enum()
61 assert("braced error: 0", Error::Braced { id: 0 }); in test_enum()
62 assert("tuple error: 0", Error::Tuple(0)); in test_enum()
63 assert("unit error", Error::Unit); in test_enum()
68 #[derive(Error, Debug)] in test_constants()
69 #[error("{MSG}: {id:?} (code {CODE:?})")] in test_constants()
70 struct Error { in test_constants() struct
77 assert("failed to do: \"\" (code 9)", Error { id: "" }); in test_constants()
82 #[derive(Error, Debug)] in test_inherit()
83 #[error("{0}")] in test_inherit()
84 enum Error { in test_inherit() enum
86 #[error("other error")] in test_inherit()
90 assert("some error", Error::Some("some error")); in test_inherit()
91 assert("other error", Error::Other("...")); in test_inherit()
96 #[derive(Error, Debug)] in test_brace_escape()
97 #[error("fn main() {{}}")] in test_brace_escape()
98 struct Error; in test_brace_escape() struct
100 assert("fn main() {}", Error); in test_brace_escape()
105 #[derive(Error, Debug)] in test_expr()
106 #[error("1 + 1 = {}", 1 + 1)] in test_expr()
107 struct Error; in test_expr() struct
108 assert("1 + 1 = 2", Error); in test_expr()
113 #[derive(Error, Debug)] in test_nested()
114 #[error("!bool = {}", not(.0))] in test_nested()
115 struct Error(bool); in test_nested() struct
122 assert("!bool = false", Error(true)); in test_nested()
127 #[derive(Error, Debug)] in test_match()
128 #[error("{}: {0}", match .1 { in test_match()
129 Some(n) => format!("error occurred with {}", n), in test_match()
130 None => "there was an empty error".to_owned(), in test_match()
132 struct Error(String, Option<usize>); in test_match() struct
135 "error occurred with 1: ...", in test_match()
136 Error("...".to_owned(), Some(1)), in test_match()
139 "there was an empty error: ...", in test_match()
140 Error("...".to_owned(), None), in test_match()
147 #[derive(Error, Debug)] in test_nested_display()
148 #[error("{}", { in test_nested_display()
153 Some(n) => write!(formatter, "error occurred with {}", n), in test_nested_display()
154 None => write!(formatter, "there was an empty error"), in test_nested_display()
161 struct Error(String, Option<usize>); in test_nested_display() struct
164 "error occurred with 1: ...", in test_nested_display()
165 Error("...".to_owned(), Some(1)), in test_nested_display()
168 "there was an empty error: ...", in test_nested_display()
169 Error("...".to_owned(), None), in test_nested_display()
176 #[derive(Error, Debug)] in test_void()
177 #[error("...")] in test_void()
178 pub enum Error {} in test_void() enum
180 let _: Error; in test_void()
185 #[derive(Error, Debug)] in test_mixed()
186 #[error("a={a} :: b={} :: c={c} :: d={d}", 1, c = 2, d = 3)] in test_mixed()
187 struct Error { in test_mixed() struct
192 assert("a=0 :: b=1 :: c=2 :: d=3", Error { a: 0, d: 0 }); in test_mixed()
197 #[derive(Error, Debug)] in test_ints()
198 enum Error { in test_ints() enum
199 #[error("error {0}")] in test_ints()
201 #[error("error {0}", '?')] in test_ints()
205 assert("error 9", Error::Tuple(9, 0)); in test_ints()
206 assert("error ?", Error::Struct { v: 0 }); in test_ints()
211 #[derive(Error, Debug)] in test_trailing_comma()
212 #[error( in test_trailing_comma()
213 "error {0}", in test_trailing_comma()
216 struct Error(char); in test_trailing_comma() struct
218 assert("error ?", Error('?')); in test_trailing_comma()
228 #[derive(Error, Debug)] in test_field()
229 #[error("{}", .0.data)] in test_field()
230 struct Error(Inner); in test_field() struct
232 assert("0", Error(Inner { data: 0 })); in test_field()
241 #[derive(Debug, Error)] in test_macro_rules()
243 #[error("{0:?}")] in test_macro_rules()
247 #[derive(Debug, Error)] in test_macro_rules()
248 #[error("{0:?}")] in test_macro_rules()
263 #[derive(Error, Debug)] in test_raw()
264 #[error("braced raw error: {r#fn}")] in test_raw()
265 struct Error { in test_raw() struct
269 assert("braced raw error: T", Error { r#fn: "T" }); in test_raw()
274 #[derive(Error, Debug)] in test_raw_enum()
275 enum Error { in test_raw_enum() enum
276 #[error("braced raw error: {r#fn}")] in test_raw_enum()
280 assert("braced raw error: T", Error::Braced { r#fn: "T" }); in test_raw_enum()
285 #[derive(Error, Debug)] in test_raw_conflict()
286 enum Error { in test_raw_conflict() enum
287 #[error("braced raw error: {r#func}, {func}", func = "U")] in test_raw_conflict()
291 assert("braced raw error: T, U", Error::Braced { r#func: "T" }); in test_raw_conflict()
296 #[derive(Error, Debug)] in test_keyword()
297 #[error("error: {type}", type = 1)] in test_keyword()
298 struct Error; in test_keyword() struct
300 assert("error: 1", Error); in test_keyword()