MCPcopy Create free account
hub / github.com/hashintel/hash / multiple_errors

Function multiple_errors

libs/error-stack/src/ext/tuple.rs:204–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

202
203 #[test]
204 fn multiple_errors() {
205 let result1: Result<i32, Report<TestError>> = Err(Report::new(TestError(0)));
206 let result2: Result<String, Report<TestError>> = Ok("test".to_owned());
207 let result3: Result<bool, Report<TestError>> = Err(Report::new(TestError(1)));
208
209 let combined = (result1, result2, result3).try_collect();
210 let report = combined.expect_err("should have error");
211
212 // order of contexts is not guaranteed
213 let contexts: BTreeSet<_> = report.current_contexts().collect();
214 assert_eq!(contexts.len(), 2);
215 assert!(contexts.contains(&TestError(0)));
216 assert!(contexts.contains(&TestError(1)));
217 }
218}

Callers

nothing calls this directly

Calls 7

ErrInterface · 0.85
OkInterface · 0.85
try_collectMethod · 0.80
collectMethod · 0.80
current_contextsMethod · 0.80
TestErrorClass · 0.70
to_ownedMethod · 0.45

Tested by

no test coverage detected