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

Function error

libs/error-stack/tests/test_compatibility.rs:18–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16#[test]
17#[cfg(any(nightly, feature = "std"))]
18fn error() {
19 let report = create_report().change_context(ContextA(10));
20 let error_ref = report.as_error();
21 assert_eq!(error_ref.to_string(), "context A");
22 #[cfg(nightly)]
23 assert_eq!(
24 *error::request_ref::<u32>(error_ref).expect("requested value not found"),
25 10
26 );
27
28 let error = report.into_error();
29 assert_eq!(error.to_string(), "context A");
30 #[cfg(nightly)]
31 assert_eq!(
32 *error::request_ref::<u32>(&error).expect("requested value not found"),
33 10
34 );
35}
36
37#[test]
38#[cfg(all(feature = "std", feature = "anyhow"))]

Callers

nothing calls this directly

Calls 5

ContextAClass · 0.85
into_errorMethod · 0.80
create_reportFunction · 0.70
change_contextMethod · 0.45
as_errorMethod · 0.45

Tested by

no test coverage detected