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

Function error

libs/error-stack/tests/test_conversion.rs:66–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64
65#[test]
66fn error() {
67 let report = error_with_sources()
68 .map_err(Report::new)
69 .expect_err("not an error");
70
71 let mut frames = report
72 .frames()
73 .skip_while(|frame| !matches!(frame.kind(), FrameKind::Context(_)));
74 assert!(frames.next().expect("no frames").is::<OuterError>());
75
76 // "inner error: other error"
77 let mut frames = frames.skip_while(|frame| !matches!(frame.kind(), FrameKind::Context(_)));
78 assert!(frames.next().is_some());
79
80 // "other error"
81 let mut frames = frames.skip_while(|frame| !matches!(frame.kind(), FrameKind::Context(_)));
82 assert!(frames.next().is_some());
83
84 // no further sources
85 let mut frames = frames.skip_while(|frame| !matches!(frame.kind(), FrameKind::Context(_)));
86 assert!(frames.next().is_none());
87}
88
89#[test]
90fn into_report() {

Callers 2

try_kpcFunction · 0.50

Calls 3

error_with_sourcesFunction · 0.85
map_errMethod · 0.80
framesMethod · 0.80

Tested by

no test coverage detected