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

Function messages

libs/error-stack/tests/common.rs:188–212  ·  view source on GitHub ↗
(report: &Report<E>)

Source from the content-addressed store, hash-verified

186}
187
188pub fn messages<E>(report: &Report<E>) -> Vec<String> {
189 report
190 .frames()
191 .map(|frame| match frame.kind() {
192 FrameKind::Context(context) => context.to_string(),
193 FrameKind::Attachment(AttachmentKind::Printable(attachment)) => attachment.to_string(),
194 FrameKind::Attachment(AttachmentKind::Opaque(_)) => {
195 #[cfg(feature = "backtrace")]
196 if frame.type_id() == TypeId::of::<Backtrace>() {
197 return String::from("Backtrace");
198 }
199 #[cfg(feature = "spantrace")]
200 if frame.type_id() == TypeId::of::<SpanTrace>() {
201 return String::from("SpanTrace");
202 }
203 if frame.type_id() == TypeId::of::<Location>() {
204 String::from("Location")
205 } else {
206 String::from("opaque")
207 }
208 }
209 FrameKind::Attachment(_) => panic!("attachment was not covered"),
210 })
211 .collect()
212}
213
214pub fn frame_kinds<E>(report: &Report<E>) -> Vec<FrameKind<'_>> {
215 remove_builtin_frames(report).map(Frame::kind).collect()

Callers 3

anyhowFunction · 0.85
anyhow_nostdFunction · 0.85
eyreFunction · 0.85

Calls 6

collectMethod · 0.80
framesMethod · 0.80
fromFunction · 0.50
mapMethod · 0.45
kindMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected