From 8af04f7e36fe884f6594c41939059ac849fb5f26 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Sun, 30 Oct 2022 13:47:02 +0100 Subject: [PATCH 01/23] feat: first implementation --- packages/libs/error-stack/Cargo.toml | 2 + packages/libs/error-stack/src/lib.rs | 2 + packages/libs/error-stack/src/ser.rs | 198 +++++++++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 packages/libs/error-stack/src/ser.rs diff --git a/packages/libs/error-stack/Cargo.toml b/packages/libs/error-stack/Cargo.toml index cd488cf721b..77308cfdee1 100644 --- a/packages/libs/error-stack/Cargo.toml +++ b/packages/libs/error-stack/Cargo.toml @@ -21,6 +21,7 @@ tracing-error = { version = "0.2", optional = true, default_features = false } anyhow = { version = "1", default-features = false, optional = true } eyre = { version = "0.6", default-features = false, optional = true } owo-colors = { version = "3", default-features = false, optional = true, features = ['supports-colors'] } +serde = { version = "1.0.147", default-features = false, optional = true } [dev-dependencies] serde = { version = "1.0.137", features = ["derive"] } @@ -45,6 +46,7 @@ pretty-print = ["dep:owo-colors"] spantrace = ["dep:tracing-error", "std"] std = ["anyhow?/std"] eyre = ["dep:eyre", "std"] +serde = ["dep:serde"] [package.metadata.docs.rs] all-features = true diff --git a/packages/libs/error-stack/src/lib.rs b/packages/libs/error-stack/src/lib.rs index 4f7aa39dc07..ff0db6d3134 100644 --- a/packages/libs/error-stack/src/lib.rs +++ b/packages/libs/error-stack/src/lib.rs @@ -474,6 +474,8 @@ pub mod fmt; mod fmt; #[cfg(feature = "std")] mod hook; +#[cfg(feature = "serde")] +mod ser; #[cfg(feature = "std")] #[allow(deprecated, unreachable_pub)] diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs new file mode 100644 index 00000000000..a42bd981014 --- /dev/null +++ b/packages/libs/error-stack/src/ser.rs @@ -0,0 +1,198 @@ +//! Implementation of general report serialization. +//! +//! The value can be of any type, currently only printable attachments and context are supported, in +//! the near future any values will be supported through the use of hooks. +//! +//! ## Attachment +//! +//! ```json5 +//! { +//! "type": "attachment", +//! "value": "..." +//! } +//! ``` +//! +//! ## Context +//! +//! ```json5 +//! { +//! "type": "context", +//! "value": "..." +//! } +//! ``` +//! +//! ## Report +//! +//! ```json5 +//! { +//! "frames": [/* Attachment | Context */], +//! "sources": [/* Report */] +//! } +//! ``` + +use std::cell::Cell; + +use serde::{ser::SerializeMap, Serialize, Serializer}; + +use crate::{AttachmentKind, Context, Frame, FrameKind, Report}; + +struct SerializeFrame<'a>(&'a Frame); + +impl<'a> Serialize for SerializeFrame<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let Self(frame) = self; + + match frame.kind() { + FrameKind::Context(context) => { + let mut map = serializer.serialize_map(Some(2))?; + + map.serialize_entry("type", "context")?; + map.serialize_entry("value", &format!("{context}"))?; + + map.end() + } + FrameKind::Attachment(AttachmentKind::Opaque(_)) => { + // these are for now NOT supported + unreachable!("`SerializeFrames` shouldn't have permitted this value") + } + FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { + let mut map = serializer.serialize_map(Some(2))?; + + map.serialize_entry("type", "attachment")?; + map.serialize_entry("value", &format!("{attachment}"))?; + + map.end() + } + } + } +} + +struct SerializeFrames<'a, I: Iterator>(Cell>); + +impl<'a, I: Iterator> Serialize for SerializeFrames<'a, I> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let frames = self + .0 + .replace(None) + .expect("`SerializeFrames` can only be called once!"); + + let frames = frames + .filter(|frame| { + !matches!( + frame.kind(), + FrameKind::Attachment(AttachmentKind::Opaque(_)) + ) + }) + .map(SerializeFrame); + + serializer.collect_seq(frames) + } +} + +struct SerializeStackIntoIter<'a> { + head: Option<&'a Frame>, +} + +impl<'a> Iterator for SerializeStackIntoIter<'a> { + type Item = &'a Frame; + + fn next(&mut self) -> Option { + let head = self.head?; + + if head.sources().len() == 1 { + self.head = Some(&head.sources()[0]); + } else { + // the next iteration would return **multiple** or **none**, therefore we return the + // current and the next one will be None + self.head = None; + } + + Some(head) + } +} + +struct SerializeStacks<'a>(&'a [Frame]); + +impl<'a> Serialize for SerializeStacks<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq( + self.0 + .iter() + .map(|frame| SerializeStack { head: Some(frame) }), + ) + } +} + +#[derive(Copy, Clone)] +struct SerializeStack<'a> { + head: Option<&'a Frame>, +} + +impl<'a> IntoIterator for SerializeStack<'a> { + type IntoIter = SerializeStackIntoIter<'a>; + type Item = &'a Frame; + + fn into_iter(self) -> Self::IntoIter { + SerializeStackIntoIter { head: self.head } + } +} + +impl<'a> Serialize for SerializeStack<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let sources = self.sources(); + + let frames = SerializeFrames(Cell::new(Some(self.into_iter()))); + + let mut map = serializer.serialize_map(Some(2))?; + map.serialize_entry("frames", &frames)?; + match sources { + None => { + map.serialize_entry::<_, [()]>("sources", &[])?; + } + Some(sources) => { + map.serialize_entry("sources", &SerializeStacks(sources))?; + } + } + + map.end() + } +} + +impl<'a> SerializeStack<'a> { + /// Peek for the next sources. e.g. where `frames.sources() > 1`, will return `None` if there + /// are `None` + fn sources(&self) -> Option<&[Frame]> { + let mut ptr = self.head?; + + while ptr.sources().len() == 1 { + ptr = &ptr.sources()[0]; + } + + match ptr.sources().len() { + 0 => None, + 1 => unreachable!(), + _ => Some(ptr.sources()), + } + } +} + +impl Serialize for Report { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + SerializeStacks(self.current_frames()).serialize(serializer) + } +} From c956c1b2c282c58d5bef53e89a56bb352e222354 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Sun, 30 Oct 2022 13:53:06 +0100 Subject: [PATCH 02/23] fix: imports --- packages/libs/error-stack/src/ser.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index a42bd981014..bb050d7b936 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -30,7 +30,8 @@ //! } //! ``` -use std::cell::Cell; +use alloc::format; +use core::cell::Cell; use serde::{ser::SerializeMap, Serialize, Serializer}; From ee0071afd2dab01dde5c4cc2e7a951675acccfb6 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Sun, 30 Oct 2022 19:18:03 +0100 Subject: [PATCH 03/23] feat: test serialize logic --- packages/libs/error-stack/Cargo.toml | 2 +- packages/libs/error-stack/Makefile.toml | 9 +++- packages/libs/error-stack/tests/common.rs | 10 ++++ .../snapshots/test_debug__full__alt.snap | 2 +- .../snapshots/test_debug__full__complex.snap | 6 +-- .../snapshots/test_debug__full__hook.snap | 2 +- .../test_debug__full__hook_context.snap | 2 +- .../test_debug__full__hook_decr.snap | 2 +- .../test_debug__full__hook_for_context.snap | 2 +- .../test_debug__full__hook_incr.snap | 2 +- .../test_debug__full__hook_multiple.snap | 2 +- .../test_debug__full__hook_provider.snap | 2 +- .../snapshots/test_debug__full__linear.snap | 2 +- .../test_debug__full__linear_ext.snap | 2 +- .../test_debug__full__multiline.snap | 2 +- .../snapshots/test_debug__full__norm.snap | 2 +- .../snapshots/test_debug__full__sources.snap | 6 +-- ...test_debug__full__sources_transparent.snap | 6 +-- ...sources_nested@backtrace-pretty-print.snap | 12 ++--- .../test_debug__sources_nested@backtrace.snap | 12 ++--- ...st_debug__sources_nested@pretty-print.snap | 12 ++--- ...sted@spantrace-backtrace-pretty-print.snap | 12 ++--- ...g__sources_nested@spantrace-backtrace.snap | 12 ++--- ...sted_alternate@backtrace-pretty-print.snap | 12 ++--- ...g__sources_nested_alternate@backtrace.snap | 12 ++--- ...sources_nested_alternate@pretty-print.snap | 12 ++--- ...nate@spantrace-backtrace-pretty-print.snap | 12 ++--- ..._nested_alternate@spantrace-backtrace.snap | 12 ++--- .../snapshots/test_serialize__attachment.snap | 19 +++++++ .../snapshots/test_serialize__context.snap | 23 ++++++++ .../libs/error-stack/tests/test_serialize.rs | 54 +++++++++++++++++++ 31 files changed, 195 insertions(+), 84 deletions(-) create mode 100644 packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap create mode 100644 packages/libs/error-stack/tests/snapshots/test_serialize__context.snap create mode 100644 packages/libs/error-stack/tests/test_serialize.rs diff --git a/packages/libs/error-stack/Cargo.toml b/packages/libs/error-stack/Cargo.toml index 77308cfdee1..5629f6d304b 100644 --- a/packages/libs/error-stack/Cargo.toml +++ b/packages/libs/error-stack/Cargo.toml @@ -30,7 +30,7 @@ futures = { version = "0.3.21", default-features = false, features = ["executor" trybuild = "1.0.63" tracing = "0.1.35" tracing-subscriber = "0.3.14" -insta = { version = "1.18.0", features = ['filters'] } +insta = { version = "1.18.0", features = ['filters', 'ron'] } regex = "1.6.0" expect-test = "1.4.0" ansi-to-html = "0.1.0" diff --git a/packages/libs/error-stack/Makefile.toml b/packages/libs/error-stack/Makefile.toml index 8747dad71cc..2843cb571da 100644 --- a/packages/libs/error-stack/Makefile.toml +++ b/packages/libs/error-stack/Makefile.toml @@ -66,13 +66,18 @@ run_task = { name = ['update-snapshots-task'] } [tasks.update-snapshots-task] private = true -run_task = { name = ['update-snapshots-task-lib', 'update-snapshots-task-doc'] } +run_task = { name = ['update-snapshots-task-lib-fmt', 'update-snapshots-task-lib-ser', 'update-snapshots-task-doc'] } -[tasks.update-snapshots-task-lib] +[tasks.update-snapshots-task-lib-fmt] extend = "cargo" args = ["hack", "@@split(CARGO_INSTA_TEST_HACK_FLAGS, )", "nextest", "run", "--cargo-profile", "${CARGO_MAKE_CARGO_PROFILE}", "@@split(CARGO_TEST_FLAGS, )", "@@split(CARGO_INSTA_TEST_FLAGS, )", "${@}"] env = { "INSTA_FORCE_PASS" = "1", "RUST_BACKTRACE" = "1", "INSTA_UPDATE" = "new" } +[tasks.update-snapshots-task-lib-ser] +extend = "cargo" +args = ["nextest", "run", "--features", "std,spantrace,serde"] +env = { "INSTA_FORCE_PASS" = "1", "RUST_BACKTRACE" = "1", "INSTA_UPDATE" = "new" } + [tasks.update-snapshots-task-doc] # only run on nightly, as backtraces are otherwise not included condition = { channels = ["nightly"] } diff --git a/packages/libs/error-stack/tests/common.rs b/packages/libs/error-stack/tests/common.rs index 7ba9a4f86e0..e1a90720085 100644 --- a/packages/libs/error-stack/tests/common.rs +++ b/packages/libs/error-stack/tests/common.rs @@ -143,6 +143,16 @@ impl fmt::Display for PrintableB { } } +#[derive(Debug, PartialEq, Eq)] +pub struct PrintableC(pub u32); + +impl fmt::Display for PrintableC { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt.write_str("printable C: ")?; + fmt::Display::fmt(&self.0, fmt) + } +} + pub fn create_report() -> Report { Report::new(RootError) } diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap index 344f31df513..8270fb707f1 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap index 5110c343d8a..476e5791d38 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap @@ -7,13 +7,13 @@ context A ├╴ printable A │ ╰┬▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ printable A │ ├▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -21,7 +21,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap index b37758bdea0..a8b2be3f1eb 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap index 9395754159d..b4f9b1fd963 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer (No. 0) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap index 3cd858ed841..879c00b68cc 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ -1 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap index 855fd3d7ec6..a839ace12b6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ 1 additional opaque attachment diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap index ec02f099352..a037d173835 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ 0 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap index c27b35bbe18..0802526b92a 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap index 7982806cf1d..236b953a7f6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap @@ -8,7 +8,7 @@ context D ├╴ &'static str: Invalid User Input │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (1) ╰╴ span trace with 2 frames (1) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap index ec385f11793..56572387ee9 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap index 49fdc11463d..f360bdb1be0 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap index 57a7279dbc0..3542626997c 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ A multiline diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap index 6d044e17f8c..1158e04ca64 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:147:5 +├╴ tests/common.rs:157:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap index 643a6ae5739..326ba676311 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap @@ -7,21 +7,21 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap index d36f1e9d0a7..30330dfd647 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap @@ -7,14 +7,14 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -22,7 +22,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap index a80a85296e1..74e56087f17 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap index 5a060eca8ba..a2d8aeb2c97 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap index 131a68d4984..d01495c4b5a 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:147:5 + ╰╴ tests/common.rs:157:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap index 8405ef3a3ac..e9569c941b9 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap index be1e2486010..057f8466462 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap index d8d404acfe9..5f5a0c3d524 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap index 0eafb5a90cb..372e9b41d9b 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap index 79235f5f2d9..cba28b0c66c 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:147:5 + │ ╰╴ tests/common.rs:157:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:147:5 + ╰╴ tests/common.rs:157:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap index 3f04bd7e79d..024a46f3c9e 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap index d9518143cfe..380cfa2025c 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap new file mode 100644 index 00000000000..79e84fb94df --- /dev/null +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap @@ -0,0 +1,19 @@ +--- +source: tests/test_serialize.rs +expression: report +--- +[ + { + "frames": [ + { + "type": "attachment", + "value": "printable A", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, +] diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap new file mode 100644 index 00000000000..c3b4b0a277b --- /dev/null +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap @@ -0,0 +1,23 @@ +--- +source: tests/test_serialize.rs +expression: report +--- +[ + { + "frames": [ + { + "type": "context", + "value": "context A", + }, + { + "type": "attachment", + "value": "printable A", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, +] diff --git a/packages/libs/error-stack/tests/test_serialize.rs b/packages/libs/error-stack/tests/test_serialize.rs new file mode 100644 index 00000000000..f4e37385599 --- /dev/null +++ b/packages/libs/error-stack/tests/test_serialize.rs @@ -0,0 +1,54 @@ +//! Note: span_trace, backtrace and such are not special cased, therefore all tests run with all +//! tests enabled. +#![cfg(all(feature = "std", feature = "spantrace", feature = "serde"))] +#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))] +#![cfg_attr(nightly, feature(provide_any))] + +use insta::assert_ron_snapshot; + +use crate::common::{create_report, ContextA, PrintableA, PrintableB, PrintableC}; + +mod common; + +fn prepare() -> impl Drop { + let settings = insta::Settings::clone_current(); + + settings.bind_to_scope() +} + +#[test] +fn attachment() { + let _guard = prepare(); + + let report = create_report().attach_printable(PrintableA(2)); + + assert_ron_snapshot!(report); +} + +#[test] +fn context() { + let _guard = prepare(); + + let report = create_report() + .attach_printable(PrintableA(2)) + .change_context(ContextA(2)); + + assert_ron_snapshot!(report); +} + +#[test] +fn multiple_sources() { + let _guard = prepare(); + + let mut a = create_report().attach(PrintableC(1)); + let b = create_report().attach(PrintableC(2)); + + a.extend_one(b); + + let a = a + .attach_printable(PrintableC(3)) + .change_context(ContextA(2)) + .attach_printable(PrintableC(4)); + + assert_ron_snapshot!(a); +} From 1097abe726e3db0432e7cc768a2f3c80bae321d1 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Sun, 30 Oct 2022 19:23:36 +0100 Subject: [PATCH 04/23] feat: test multiple sources --- .../test_serialize__multiple_sources.snap | 50 +++++++++++++++++++ ...t_serialize__multiple_sources_at_root.snap | 32 ++++++++++++ .../libs/error-stack/tests/test_serialize.rs | 16 +++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap create mode 100644 packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap new file mode 100644 index 00000000000..d3a612ccd29 --- /dev/null +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap @@ -0,0 +1,50 @@ +--- +source: tests/test_serialize.rs +expression: a +--- +[ + { + "frames": [ + { + "type": "attachment", + "value": "printable C: 4", + }, + { + "type": "context", + "value": "context A", + }, + { + "type": "attachment", + "value": "printable C: 3", + }, + ], + "sources": [ + { + "frames": [ + { + "type": "attachment", + "value": "printable C: 1", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, + { + "frames": [ + { + "type": "attachment", + "value": "printable C: 2", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, + ], + }, +] diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap new file mode 100644 index 00000000000..f4187f65019 --- /dev/null +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap @@ -0,0 +1,32 @@ +--- +source: tests/test_serialize.rs +expression: a +--- +[ + { + "frames": [ + { + "type": "attachment", + "value": "printable C: 1", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, + { + "frames": [ + { + "type": "attachment", + "value": "printable C: 2", + }, + { + "type": "context", + "value": "root error", + }, + ], + "sources": [], + }, +] diff --git a/packages/libs/error-stack/tests/test_serialize.rs b/packages/libs/error-stack/tests/test_serialize.rs index f4e37385599..fa226db6fb5 100644 --- a/packages/libs/error-stack/tests/test_serialize.rs +++ b/packages/libs/error-stack/tests/test_serialize.rs @@ -40,8 +40,8 @@ fn context() { fn multiple_sources() { let _guard = prepare(); - let mut a = create_report().attach(PrintableC(1)); - let b = create_report().attach(PrintableC(2)); + let mut a = create_report().attach_printable(PrintableC(1)); + let b = create_report().attach_printable(PrintableC(2)); a.extend_one(b); @@ -52,3 +52,15 @@ fn multiple_sources() { assert_ron_snapshot!(a); } + +#[test] +fn multiple_sources_at_root() { + let _guard = prepare(); + + let mut a = create_report().attach_printable(PrintableC(1)); + let b = create_report().attach_printable(PrintableC(2)); + + a.extend_one(b); + + assert_ron_snapshot!(a); +} From 974614dd86ac8a344bcaf773816c9570c19dba51 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Tue, 1 Nov 2022 10:11:20 +0100 Subject: [PATCH 05/23] fix: lint --- packages/libs/error-stack/tests/test_serialize.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/libs/error-stack/tests/test_serialize.rs b/packages/libs/error-stack/tests/test_serialize.rs index fa226db6fb5..a1b12441999 100644 --- a/packages/libs/error-stack/tests/test_serialize.rs +++ b/packages/libs/error-stack/tests/test_serialize.rs @@ -6,7 +6,7 @@ use insta::assert_ron_snapshot; -use crate::common::{create_report, ContextA, PrintableA, PrintableB, PrintableC}; +use crate::common::{create_report, ContextA, PrintableA, PrintableC}; mod common; From 7f4c5b09b4e5ffe75d48bcbb884c0f219b3a5631 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Tue, 1 Nov 2022 10:13:14 +0100 Subject: [PATCH 06/23] chore: update snapshots --- .../tests/snapshots/test_debug__sources_nested.snap | 12 ++++++------ ...debug__sources_nested@spantrace-pretty-print.snap | 12 ++++++------ .../test_debug__sources_nested@spantrace.snap | 12 ++++++------ .../test_debug__sources_nested_alternate.snap | 12 ++++++------ ...rces_nested_alternate@spantrace-pretty-print.snap | 12 ++++++------ ...st_debug__sources_nested_alternate@spantrace.snap | 12 ++++++------ 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap index 10bd471ecf0..0aa0d4b892c 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap index 9fd04b69eb5..0ff644b2ef5 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap index 9cc2b866c5b..d155ff8e143 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- span trace with 2 frames (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap index 37db28550e6..52d25a728fc 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap index 0ac760ac823..8042684a405 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:147:5 + │ ├╴ tests/common.rs:157:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:147:5 + ├╴ tests/common.rs:157:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap index c3f66750a50..397111e9dc6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:147:5 + | |- at tests/common.rs:157:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:147:5 + |- at tests/common.rs:157:5 |- span trace with 2 frames (6) ======================================== From 83bff7f4b895947c797349908e4be2c7b7cc4d5e Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Tue, 1 Nov 2022 10:26:20 +0100 Subject: [PATCH 07/23] ci: explicit `no-default` update-snapshot task --- packages/libs/error-stack/Makefile.toml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/libs/error-stack/Makefile.toml b/packages/libs/error-stack/Makefile.toml index 2843cb571da..b42cb9573c6 100644 --- a/packages/libs/error-stack/Makefile.toml +++ b/packages/libs/error-stack/Makefile.toml @@ -66,7 +66,7 @@ run_task = { name = ['update-snapshots-task'] } [tasks.update-snapshots-task] private = true -run_task = { name = ['update-snapshots-task-lib-fmt', 'update-snapshots-task-lib-ser', 'update-snapshots-task-doc'] } +run_task = { name = ['update-snapshots-task-lib-fmt', 'update-snapshots-task-lib-ser', 'update-snapshots-task-lib-no-default', 'update-snapshots-task-doc'] } [tasks.update-snapshots-task-lib-fmt] extend = "cargo" @@ -75,7 +75,12 @@ env = { "INSTA_FORCE_PASS" = "1", "RUST_BACKTRACE" = "1", "INSTA_UPDATE" = "new" [tasks.update-snapshots-task-lib-ser] extend = "cargo" -args = ["nextest", "run", "--features", "std,spantrace,serde"] +args = ["nextest", "run", "--cargo-profile", "${CARGO_MAKE_CARGO_PROFILE}", "@@split(CARGO_TEST_FLAGS, )", "--features", "std,spantrace,serde"] +env = { "INSTA_FORCE_PASS" = "1", "RUST_BACKTRACE" = "1", "INSTA_UPDATE" = "new" } + +[tasks.update-snapshots-task-lib-no-default] +extend = "cargo" +args = ["nextest", "run", "--cargo-profile", "${CARGO_MAKE_CARGO_PROFILE}", "@@split(CARGO_TEST_FLAGS, )", '--no-default-features'] env = { "INSTA_FORCE_PASS" = "1", "RUST_BACKTRACE" = "1", "INSTA_UPDATE" = "new" } [tasks.update-snapshots-task-doc] From 61f4112555dc318e4dba3b6097f9db846cf6eec9 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Tue, 1 Nov 2022 10:50:46 +0100 Subject: [PATCH 08/23] fix: `insta` does not like `miri`, therefore disabled --- packages/libs/error-stack/tests/test_serialize.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/libs/error-stack/tests/test_serialize.rs b/packages/libs/error-stack/tests/test_serialize.rs index a1b12441999..0f4ee96aa07 100644 --- a/packages/libs/error-stack/tests/test_serialize.rs +++ b/packages/libs/error-stack/tests/test_serialize.rs @@ -1,6 +1,9 @@ //! Note: span_trace, backtrace and such are not special cased, therefore all tests run with all //! tests enabled. #![cfg(all(feature = "std", feature = "spantrace", feature = "serde"))] +// can be considered safe, because we only check the output, which in itself does not use **any** +// unsafe code. +#![cfg(not(miri))] #![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))] #![cfg_attr(nightly, feature(provide_any))] From eeaedbb884689dd8c1f4bbab5afffa681d153a23 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 13:52:11 +0100 Subject: [PATCH 09/23] feat: apply suggestions from talks --- packages/libs/error-stack/src/ser.rs | 145 ++++----------------------- 1 file changed, 18 insertions(+), 127 deletions(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index bb050d7b936..35b52554f13 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -31,12 +31,22 @@ //! ``` use alloc::format; -use core::cell::Cell; use serde::{ser::SerializeMap, Serialize, Serializer}; use crate::{AttachmentKind, Context, Frame, FrameKind, Report}; +struct SerializeFrames<'a>(&'a [Frame]); + +impl<'a> Serialize for SerializeFrames<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq(self.0.iter().map(SerializeFrame)) + } +} + struct SerializeFrame<'a>(&'a Frame); impl<'a> Serialize for SerializeFrame<'a> { @@ -46,154 +56,35 @@ impl<'a> Serialize for SerializeFrame<'a> { { let Self(frame) = self; + let mut map = serializer.serialize_map(Some(3))?; + match frame.kind() { FrameKind::Context(context) => { - let mut map = serializer.serialize_map(Some(2))?; - map.serialize_entry("type", "context")?; map.serialize_entry("value", &format!("{context}"))?; - - map.end() } FrameKind::Attachment(AttachmentKind::Opaque(_)) => { - // these are for now NOT supported - unreachable!("`SerializeFrames` shouldn't have permitted this value") + map.serialize_entry("type", "attachment")?; + // TODO: for now opaque attachments are unsupported, upcoming PR will fix that + map.serialize_entry("value", &())?; } FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { - let mut map = serializer.serialize_map(Some(2))?; - map.serialize_entry("type", "attachment")?; map.serialize_entry("value", &format!("{attachment}"))?; - - map.end() } } - } -} -struct SerializeFrames<'a, I: Iterator>(Cell>); - -impl<'a, I: Iterator> Serialize for SerializeFrames<'a, I> { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let frames = self - .0 - .replace(None) - .expect("`SerializeFrames` can only be called once!"); - - let frames = frames - .filter(|frame| { - !matches!( - frame.kind(), - FrameKind::Attachment(AttachmentKind::Opaque(_)) - ) - }) - .map(SerializeFrame); - - serializer.collect_seq(frames) - } -} - -struct SerializeStackIntoIter<'a> { - head: Option<&'a Frame>, -} - -impl<'a> Iterator for SerializeStackIntoIter<'a> { - type Item = &'a Frame; - - fn next(&mut self) -> Option { - let head = self.head?; - - if head.sources().len() == 1 { - self.head = Some(&head.sources()[0]); - } else { - // the next iteration would return **multiple** or **none**, therefore we return the - // current and the next one will be None - self.head = None; - } - - Some(head) - } -} - -struct SerializeStacks<'a>(&'a [Frame]); - -impl<'a> Serialize for SerializeStacks<'a> { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.collect_seq( - self.0 - .iter() - .map(|frame| SerializeStack { head: Some(frame) }), - ) - } -} - -#[derive(Copy, Clone)] -struct SerializeStack<'a> { - head: Option<&'a Frame>, -} - -impl<'a> IntoIterator for SerializeStack<'a> { - type IntoIter = SerializeStackIntoIter<'a>; - type Item = &'a Frame; - - fn into_iter(self) -> Self::IntoIter { - SerializeStackIntoIter { head: self.head } - } -} - -impl<'a> Serialize for SerializeStack<'a> { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - let sources = self.sources(); - - let frames = SerializeFrames(Cell::new(Some(self.into_iter()))); - - let mut map = serializer.serialize_map(Some(2))?; - map.serialize_entry("frames", &frames)?; - match sources { - None => { - map.serialize_entry::<_, [()]>("sources", &[])?; - } - Some(sources) => { - map.serialize_entry("sources", &SerializeStacks(sources))?; - } - } + map.serialize_entry("sources", &SerializeFrames(frame.sources()))?; map.end() } } -impl<'a> SerializeStack<'a> { - /// Peek for the next sources. e.g. where `frames.sources() > 1`, will return `None` if there - /// are `None` - fn sources(&self) -> Option<&[Frame]> { - let mut ptr = self.head?; - - while ptr.sources().len() == 1 { - ptr = &ptr.sources()[0]; - } - - match ptr.sources().len() { - 0 => None, - 1 => unreachable!(), - _ => Some(ptr.sources()), - } - } -} - impl Serialize for Report { fn serialize(&self, serializer: S) -> Result where S: Serializer, { - SerializeStacks(self.current_frames()).serialize(serializer) + serializer.collect_seq(self.current_frames().iter().map(SerializeFrame)) } } From b63304752e70ab534244d6200bb89720a777a46f Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:03:49 +0100 Subject: [PATCH 10/23] fix: replace `()` with `None` for opaque attachments --- packages/libs/error-stack/src/ser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index 35b52554f13..9e990cc9cf2 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -66,7 +66,7 @@ impl<'a> Serialize for SerializeFrame<'a> { FrameKind::Attachment(AttachmentKind::Opaque(_)) => { map.serialize_entry("type", "attachment")?; // TODO: for now opaque attachments are unsupported, upcoming PR will fix that - map.serialize_entry("value", &())?; + map.serialize_entry("value", &Option::<()>::None)?; } FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { map.serialize_entry("type", "attachment")?; From 667479b4c7f5342937660b2d9a3b9d9afcc46788 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:03:57 +0100 Subject: [PATCH 11/23] fix: merge errors --- packages/libs/error-stack/tests/common.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/libs/error-stack/tests/common.rs b/packages/libs/error-stack/tests/common.rs index b44f16647bb..90d3697bb76 100644 --- a/packages/libs/error-stack/tests/common.rs +++ b/packages/libs/error-stack/tests/common.rs @@ -1,9 +1,5 @@ #![allow(dead_code)] -pub fn create_report() -> Report { - Report::new(RootError) -} - extern crate alloc; pub use alloc::{ @@ -152,7 +148,6 @@ impl fmt::Display for PrintableB { } } -<<<<<<< HEAD #[derive(Debug, PartialEq, Eq)] pub struct PrintableC(pub u32); @@ -167,8 +162,6 @@ pub fn create_report() -> Report { Report::new(RootError) } -======= ->>>>>>> origin/main pub fn create_error() -> Result<(), RootError> { Err(create_report()) } From cb0c7b7818442d411b440b57aa75e6c2f5431dd1 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:04:20 +0100 Subject: [PATCH 12/23] chore: update snapshots --- .../snapshots/test_debug__full__alt.snap | 6 +- .../snapshots/test_debug__full__complex.snap | 18 +--- .../snapshots/test_debug__full__hook.snap | 2 +- .../test_debug__full__hook_context.snap | 2 +- .../test_debug__full__hook_decr.snap | 2 +- .../test_debug__full__hook_for_context.snap | 2 +- .../test_debug__full__hook_incr.snap | 2 +- .../test_debug__full__hook_multiple.snap | 2 +- .../test_debug__full__hook_provider.snap | 4 +- .../snapshots/test_debug__full__linear.snap | 2 +- .../test_debug__full__linear_ext.snap | 2 +- .../test_debug__full__multiline.snap | 2 +- .../snapshots/test_debug__full__norm.snap | 2 +- .../snapshots/test_debug__full__sources.snap | 6 +- ...test_debug__full__sources_transparent.snap | 6 +- .../snapshots/test_debug__sources_nested.snap | 12 +-- ...sources_nested@backtrace-pretty-print.snap | 12 +-- .../test_debug__sources_nested@backtrace.snap | 12 +-- ...st_debug__sources_nested@pretty-print.snap | 12 +-- ...sted@spantrace-backtrace-pretty-print.snap | 12 +-- ...g__sources_nested@spantrace-backtrace.snap | 12 +-- ...sources_nested@spantrace-pretty-print.snap | 12 +-- .../test_debug__sources_nested@spantrace.snap | 12 +-- .../test_debug__sources_nested_alternate.snap | 12 +-- ...sted_alternate@backtrace-pretty-print.snap | 12 +-- ...g__sources_nested_alternate@backtrace.snap | 12 +-- ...sources_nested_alternate@pretty-print.snap | 12 +-- ...nate@spantrace-backtrace-pretty-print.snap | 12 +-- ..._nested_alternate@spantrace-backtrace.snap | 12 +-- ...sted_alternate@spantrace-pretty-print.snap | 12 +-- ...g__sources_nested_alternate@spantrace.snap | 12 +-- .../snapshots/test_serialize__attachment.snap | 18 ++-- .../snapshots/test_serialize__context.snap | 32 +++++--- .../test_serialize__multiple_sources.snap | 82 +++++++++++-------- ...t_serialize__multiple_sources_at_root.snap | 36 ++++---- .../libs/error-stack/tests/test_serialize.rs | 2 + 36 files changed, 223 insertions(+), 199 deletions(-) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap index 22b7ae249a4..d4b8a23fc67 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap @@ -3,11 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -<<<<<<< HEAD -├╴ tests/common.rs:157:5 -======= -├╴ tests/common.rs:4:5 ->>>>>>> origin/main +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap index 9f4bcd14612..6f01385af39 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap @@ -7,21 +7,13 @@ context A ├╴ printable A │ ╰┬▶ root error -<<<<<<< HEAD - │ ├╴ tests/common.rs:157:5 -======= - │ ├╴ tests/common.rs:4:5 ->>>>>>> origin/main + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ printable A │ ├▶ root error -<<<<<<< HEAD - │ ├╴ tests/common.rs:157:5 -======= - │ ├╴ tests/common.rs:4:5 ->>>>>>> origin/main + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -29,11 +21,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error -<<<<<<< HEAD - ├╴ tests/common.rs:157:5 -======= - ├╴ tests/common.rs:4:5 ->>>>>>> origin/main + ├╴ tests/common.rs:162:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap index a8b2be3f1eb..37542cfd7b0 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap index b4f9b1fd963..426c54a2cfa 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer (No. 0) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap index 879c00b68cc..d76fb347fa1 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ -1 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap index a839ace12b6..a1944bc3531 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ 1 additional opaque attachment diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap index a037d173835..d24c80d6309 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ 0 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap index 0802526b92a..9c859aea964 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap index 236b953a7f6..2ebf880f025 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap @@ -3,12 +3,12 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- context D -├╴ tests/test_debug.rs:597:38 ├╴ usize: 420 ├╴ &'static str: Invalid User Input +├╴ tests/test_debug.rs:597:38 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (1) ╰╴ span trace with 2 frames (1) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap index 56572387ee9..86c3edab9cd 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap index f360bdb1be0..da037628445 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap index 3542626997c..c3606f7da41 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ A multiline diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap index 1158e04ca64..ee34bfb4ebd 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:157:5 +├╴ tests/common.rs:162:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap index 326ba676311..790a3666de6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap @@ -7,21 +7,21 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap index 30330dfd647..8fef3fb91fa 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap @@ -7,14 +7,14 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -22,7 +22,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap index 0aa0d4b892c..1b74e862267 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap index 74e56087f17..e355c1020fa 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap index a2d8aeb2c97..087519540eb 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap index d01495c4b5a..3c501b77a69 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:157:5 + ╰╴ tests/common.rs:162:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap index e9569c941b9..13fa6aa89a6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap index 057f8466462..99dfcb12045 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap index 0ff644b2ef5..7868366dba5 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap index d155ff8e143..74c8adafd3f 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- span trace with 2 frames (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap index 52d25a728fc..aa78eef2eb0 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap index 5f5a0c3d524..1d8e929bafb 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap index 372e9b41d9b..5d79458ea45 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap index cba28b0c66c..a1686aa0a33 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:157:5 + │ ╰╴ tests/common.rs:162:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:157:5 + ╰╴ tests/common.rs:162:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap index 024a46f3c9e..482cd681788 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap index 380cfa2025c..4b15f70bf3a 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap index 8042684a405..366ef340120 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:157:5 + │ ├╴ tests/common.rs:162:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:157:5 + ├╴ tests/common.rs:162:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap index 397111e9dc6..f00ccdfd5b4 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:157:5 + | |- at tests/common.rs:162:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:157:5 + |- at tests/common.rs:162:5 |- span trace with 2 frames (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap index 79e84fb94df..c7dda257c39 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap @@ -4,16 +4,20 @@ expression: report --- [ { - "frames": [ + "type": "attachment", + "value": "printable A", + "sources": [ { "type": "attachment", - "value": "printable A", - }, - { - "type": "context", - "value": "root error", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], }, ], - "sources": [], }, ] diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap index c3b4b0a277b..695a31ff89e 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap @@ -4,20 +4,32 @@ expression: report --- [ { - "frames": [ + "type": "attachment", + "value": None, + "sources": [ { "type": "context", "value": "context A", - }, - { - "type": "attachment", - "value": "printable A", - }, - { - "type": "context", - "value": "root error", + "sources": [ + { + "type": "attachment", + "value": "printable A", + "sources": [ + { + "type": "attachment", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], + }, + ], + }, + ], }, ], - "sources": [], }, ] diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap index d3a612ccd29..26b97be0a79 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap @@ -4,46 +4,60 @@ expression: a --- [ { - "frames": [ - { - "type": "attachment", - "value": "printable C: 4", - }, - { - "type": "context", - "value": "context A", - }, - { - "type": "attachment", - "value": "printable C: 3", - }, - ], + "type": "attachment", + "value": "printable C: 4", "sources": [ { - "frames": [ - { - "type": "attachment", - "value": "printable C: 1", - }, - { - "type": "context", - "value": "root error", - }, - ], - "sources": [], - }, - { - "frames": [ - { - "type": "attachment", - "value": "printable C: 2", - }, + "type": "attachment", + "value": None, + "sources": [ { "type": "context", - "value": "root error", + "value": "context A", + "sources": [ + { + "type": "attachment", + "value": "printable C: 3", + "sources": [ + { + "type": "attachment", + "value": "printable C: 1", + "sources": [ + { + "type": "attachment", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], + }, + ], + }, + { + "type": "attachment", + "value": "printable C: 2", + "sources": [ + { + "type": "attachment", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], + }, + ], + }, + ], + }, + ], }, ], - "sources": [], }, ], }, diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap index f4187f65019..b3b820df786 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap @@ -4,29 +4,37 @@ expression: a --- [ { - "frames": [ + "type": "attachment", + "value": "printable C: 1", + "sources": [ { "type": "attachment", - "value": "printable C: 1", - }, - { - "type": "context", - "value": "root error", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], }, ], - "sources": [], }, { - "frames": [ + "type": "attachment", + "value": "printable C: 2", + "sources": [ { "type": "attachment", - "value": "printable C: 2", - }, - { - "type": "context", - "value": "root error", + "value": None, + "sources": [ + { + "type": "context", + "value": "root error", + "sources": [], + }, + ], }, ], - "sources": [], }, ] diff --git a/packages/libs/error-stack/tests/test_serialize.rs b/packages/libs/error-stack/tests/test_serialize.rs index 0f4ee96aa07..96e50ee4ab7 100644 --- a/packages/libs/error-stack/tests/test_serialize.rs +++ b/packages/libs/error-stack/tests/test_serialize.rs @@ -14,6 +14,8 @@ use crate::common::{create_report, ContextA, PrintableA, PrintableC}; mod common; fn prepare() -> impl Drop { + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + let settings = insta::Settings::clone_current(); settings.bind_to_scope() From 92401395cf79aeb6613aec5268720400bfb990fb Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:35:01 +0100 Subject: [PATCH 13/23] feat: implement suggestions --- packages/libs/error-stack/src/ser.rs | 127 ++++++++++++++---- .../snapshots/test_serialize__attachment.snap | 18 +-- .../snapshots/test_serialize__context.snap | 28 +--- .../test_serialize__multiple_sources.snap | 68 +++------- ...t_serialize__multiple_sources_at_root.snap | 36 ++--- 5 files changed, 138 insertions(+), 139 deletions(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index 9e990cc9cf2..bd12e9a9faf 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -36,55 +36,134 @@ use serde::{ser::SerializeMap, Serialize, Serializer}; use crate::{AttachmentKind, Context, Frame, FrameKind, Report}; -struct SerializeFrames<'a>(&'a [Frame]); +struct SerializeAttachment<'a>(&'a Frame); -impl<'a> Serialize for SerializeFrames<'a> { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.collect_seq(self.0.iter().map(SerializeFrame)) - } -} - -struct SerializeFrame<'a>(&'a Frame); - -impl<'a> Serialize for SerializeFrame<'a> { +impl<'a> Serialize for SerializeAttachment<'a> { fn serialize(&self, serializer: S) -> Result where S: Serializer, { let Self(frame) = self; - let mut map = serializer.serialize_map(Some(3))?; - + #[allow(clippy::match_same_arms)] match frame.kind() { - FrameKind::Context(context) => { - map.serialize_entry("type", "context")?; - map.serialize_entry("value", &format!("{context}"))?; + FrameKind::Context(_) => { + // `SerializeContext` ensures that no context is ever serialized + unreachable!() } FrameKind::Attachment(AttachmentKind::Opaque(_)) => { - map.serialize_entry("type", "attachment")?; // TODO: for now opaque attachments are unsupported, upcoming PR will fix that - map.serialize_entry("value", &Option::<()>::None)?; + // `SerializeContext` ensures that no such attachment is added + unreachable!() } FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { - map.serialize_entry("type", "attachment")?; - map.serialize_entry("value", &format!("{attachment}"))?; + format!("{attachment}").serialize(serializer) } } + } +} + +struct SerializeAttachments<'a, 'b>(&'a [&'b Frame]); + +impl<'a, 'b> Serialize for SerializeAttachments<'a, 'b> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq( + self.0 + .iter() + .copied() + .filter(|attachment| { + // for now opaque attachments are ignored + !matches!( + attachment.kind(), + FrameKind::Attachment(AttachmentKind::Opaque(_)) + ) + }) + .map(SerializeAttachment), + ) + } +} + +struct SerializeContext<'a> { + attachments: Vec<&'a Frame>, + context: &'a dyn Context, + sources: &'a [Frame], +} - map.serialize_entry("sources", &SerializeFrames(frame.sources()))?; +impl<'a> Serialize for SerializeContext<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let Self { + context, + attachments, + sources, + } = self; + + let mut map = serializer.serialize_map(Some(3))?; + map.serialize_entry("value", &format!("{context}"))?; + map.serialize_entry("attachments", &SerializeAttachments(&attachments[..]))?; + map.serialize_entry("sources", &SerializeSources(sources))?; map.end() } } +struct SerializeSources<'a>(&'a [Frame]); + +impl<'a> Serialize for SerializeSources<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq(self.0.iter().flat_map(|source| find_next(&[], source))) + } +} + +// find the next applicable context and return the serializer +fn find_next<'a>(head: &[&'a Frame], mut current: &'a Frame) -> Vec> { + let mut attachments = vec![]; + attachments.extend(head); + + loop { + if let FrameKind::Context(context) = current.kind() { + // found the context, return all attachments (reversed) + attachments.reverse(); + + return vec![SerializeContext { + attachments, + context, + sources: current.sources(), + }]; + } else if current.sources().len() > 1 { + // current is an attachment, add to attachments and recursively probe + attachments.push(current); + + return current + .sources() + .iter() + .flat_map(|source| find_next(&attachments, source)) + .collect(); + } else if current.sources().len() == 1 { + attachments.push(current); + + current = ¤t.sources()[0]; + } else { + // there are no more frames, therefore we need to abandon + // this is theoretically impossible (the bottom is always a context), but not enforced + return vec![]; + } + } +} + impl Serialize for Report { fn serialize(&self, serializer: S) -> Result where S: Serializer, { - serializer.collect_seq(self.current_frames().iter().map(SerializeFrame)) + SerializeSources(self.current_frames()).serialize(serializer) } } diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap index c7dda257c39..294056dce3f 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap @@ -4,20 +4,10 @@ expression: report --- [ { - "type": "attachment", - "value": "printable A", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, + "value": "root error", + "attachments": [ + "printable A", ], + "sources": [], }, ] diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap index 695a31ff89e..f0d32004cbf 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap @@ -4,31 +4,15 @@ expression: report --- [ { - "type": "attachment", - "value": None, + "value": "context A", + "attachments": [], "sources": [ { - "type": "context", - "value": "context A", - "sources": [ - { - "type": "attachment", - "value": "printable A", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, - ], - }, + "value": "root error", + "attachments": [ + "printable A", ], + "sources": [], }, ], }, diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap index 26b97be0a79..b3dbacaa238 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap @@ -4,60 +4,26 @@ expression: a --- [ { - "type": "attachment", - "value": "printable C: 4", + "value": "context A", + "attachments": [ + "printable C: 4", + ], "sources": [ { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "context A", - "sources": [ - { - "type": "attachment", - "value": "printable C: 3", - "sources": [ - { - "type": "attachment", - "value": "printable C: 1", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, - ], - }, - { - "type": "attachment", - "value": "printable C: 2", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, - ], - }, - ], - }, - ], - }, + "value": "root error", + "attachments": [ + "printable C: 1", + "printable C: 3", + ], + "sources": [], + }, + { + "value": "root error", + "attachments": [ + "printable C: 2", + "printable C: 3", ], + "sources": [], }, ], }, diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap index b3b820df786..a570bf2ff42 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap @@ -4,37 +4,17 @@ expression: a --- [ { - "type": "attachment", - "value": "printable C: 1", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, + "value": "root error", + "attachments": [ + "printable C: 1", ], + "sources": [], }, { - "type": "attachment", - "value": "printable C: 2", - "sources": [ - { - "type": "attachment", - "value": None, - "sources": [ - { - "type": "context", - "value": "root error", - "sources": [], - }, - ], - }, + "value": "root error", + "attachments": [ + "printable C: 2", ], + "sources": [], }, ] From 2d3b42f7dc529aa3ee097382197b5dca09758f3c Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:42:22 +0100 Subject: [PATCH 14/23] docs: adjust sources --- packages/libs/error-stack/src/ser.rs | 31 +++++++--------------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index bd12e9a9faf..d862c770af4 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -3,34 +3,17 @@ //! The value can be of any type, currently only printable attachments and context are supported, in //! the near future any values will be supported through the use of hooks. //! -//! ## Attachment +//! The returned JSON returned is a list of all current sources with the following output: //! -//! ```json5 +//! ```json //! { -//! "type": "attachment", -//! "value": "..." -//! } -//! ``` -//! -//! ## Context -//! -//! ```json5 -//! { -//! "type": "context", -//! "value": "..." -//! } -//! ``` -//! -//! ## Report -//! -//! ```json5 -//! { -//! "frames": [/* Attachment | Context */], -//! "sources": [/* Report */] +//! "context": "string value", +//! "attachments": ["all attachments leading up to this context"], +//! "sources": [] // recursive render using `frame.sources()` //! } //! ``` -use alloc::format; +use alloc::{format, vec::Vec}; use serde::{ser::SerializeMap, Serialize, Serializer}; @@ -104,7 +87,7 @@ impl<'a> Serialize for SerializeContext<'a> { } = self; let mut map = serializer.serialize_map(Some(3))?; - map.serialize_entry("value", &format!("{context}"))?; + map.serialize_entry("context", &format!("{context}"))?; map.serialize_entry("attachments", &SerializeAttachments(&attachments[..]))?; map.serialize_entry("sources", &SerializeSources(sources))?; From f4c6722661d2ecb9c14aa7cc898b02a8687624db Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:45:21 +0100 Subject: [PATCH 15/23] chore: update snapshots --- .../tests/snapshots/test_serialize__attachment.snap | 2 +- .../tests/snapshots/test_serialize__context.snap | 4 ++-- .../tests/snapshots/test_serialize__multiple_sources.snap | 6 +++--- .../snapshots/test_serialize__multiple_sources_at_root.snap | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap index 294056dce3f..7ac05a2a78e 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__attachment.snap @@ -4,7 +4,7 @@ expression: report --- [ { - "value": "root error", + "context": "root error", "attachments": [ "printable A", ], diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap index f0d32004cbf..82d16414c23 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__context.snap @@ -4,11 +4,11 @@ expression: report --- [ { - "value": "context A", + "context": "context A", "attachments": [], "sources": [ { - "value": "root error", + "context": "root error", "attachments": [ "printable A", ], diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap index b3dbacaa238..4ca67eb9ed0 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources.snap @@ -4,13 +4,13 @@ expression: a --- [ { - "value": "context A", + "context": "context A", "attachments": [ "printable C: 4", ], "sources": [ { - "value": "root error", + "context": "root error", "attachments": [ "printable C: 1", "printable C: 3", @@ -18,7 +18,7 @@ expression: a "sources": [], }, { - "value": "root error", + "context": "root error", "attachments": [ "printable C: 2", "printable C: 3", diff --git a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap index a570bf2ff42..e993e0f4724 100644 --- a/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap +++ b/packages/libs/error-stack/tests/snapshots/test_serialize__multiple_sources_at_root.snap @@ -4,14 +4,14 @@ expression: a --- [ { - "value": "root error", + "context": "root error", "attachments": [ "printable C: 1", ], "sources": [], }, { - "value": "root error", + "context": "root error", "attachments": [ "printable C: 2", ], From 20cc01b65dc57b66ba85ce5cc179032b58d3b027 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Wed, 9 Nov 2022 14:48:07 +0100 Subject: [PATCH 16/23] fix: clippy --- packages/libs/error-stack/src/ser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index d862c770af4..adf25b0ef41 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -13,7 +13,7 @@ //! } //! ``` -use alloc::{format, vec::Vec}; +use alloc::{format, vec, vec::Vec}; use serde::{ser::SerializeMap, Serialize, Serializer}; From cd3f8edfc40f13b81ddd530892846e8d856df662 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 18:50:01 +0100 Subject: [PATCH 17/23] Apply suggestions from code review Co-authored-by: Tim Diekmann <21277928+TimDiekmann@users.noreply.github.com> --- packages/libs/error-stack/src/ser.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/ser.rs index adf25b0ef41..f0a0ac20aa6 100644 --- a/packages/libs/error-stack/src/ser.rs +++ b/packages/libs/error-stack/src/ser.rs @@ -1,13 +1,13 @@ -//! Implementation of general report serialization. +//! Implementation of general [`Report`] serialization. //! //! The value can be of any type, currently only printable attachments and context are supported, in //! the near future any values will be supported through the use of hooks. //! -//! The returned JSON returned is a list of all current sources with the following output: +//! The serialized [`Report`] is a list of all current sources with the following output: //! //! ```json //! { -//! "context": "string value", +//! "context": "context display output", //! "attachments": ["all attachments leading up to this context"], //! "sources": [] // recursive render using `frame.sources()` //! } @@ -37,7 +37,7 @@ impl<'a> Serialize for SerializeAttachment<'a> { FrameKind::Attachment(AttachmentKind::Opaque(_)) => { // TODO: for now opaque attachments are unsupported, upcoming PR will fix that // `SerializeContext` ensures that no such attachment is added - unreachable!() + todo!() } FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { format!("{attachment}").serialize(serializer) From 014767941aa81eb87e56bdfc21492f85ee8eae06 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 18:52:46 +0100 Subject: [PATCH 18/23] chore: rename `ser` to `serde` --- packages/libs/error-stack/src/lib.rs | 2 +- packages/libs/error-stack/src/{ser.rs => serde.rs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/libs/error-stack/src/{ser.rs => serde.rs} (100%) diff --git a/packages/libs/error-stack/src/lib.rs b/packages/libs/error-stack/src/lib.rs index 8c3b493c16c..5c9f954c1b3 100644 --- a/packages/libs/error-stack/src/lib.rs +++ b/packages/libs/error-stack/src/lib.rs @@ -478,7 +478,7 @@ mod fmt; #[cfg(feature = "std")] mod hook; #[cfg(feature = "serde")] -mod ser; +mod serde; #[cfg(feature = "std")] #[allow(deprecated, unreachable_pub)] diff --git a/packages/libs/error-stack/src/ser.rs b/packages/libs/error-stack/src/serde.rs similarity index 100% rename from packages/libs/error-stack/src/ser.rs rename to packages/libs/error-stack/src/serde.rs From 0414ac33a2e77fd9a0b6d8675329e9d52573cab4 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 18:54:25 +0100 Subject: [PATCH 19/23] docs: clarify why context --- packages/libs/error-stack/src/serde.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/libs/error-stack/src/serde.rs b/packages/libs/error-stack/src/serde.rs index f0a0ac20aa6..5251a0065f2 100644 --- a/packages/libs/error-stack/src/serde.rs +++ b/packages/libs/error-stack/src/serde.rs @@ -31,8 +31,9 @@ impl<'a> Serialize for SerializeAttachment<'a> { #[allow(clippy::match_same_arms)] match frame.kind() { FrameKind::Context(_) => { + // TODO: for now `Context` is unsupported, upcoming PR will fix via hooks // `SerializeContext` ensures that no context is ever serialized - unreachable!() + todo!() } FrameKind::Attachment(AttachmentKind::Opaque(_)) => { // TODO: for now opaque attachments are unsupported, upcoming PR will fix that From 43279baa1177e08e4826dcad20d6ac0cd31130b6 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 18:55:38 +0100 Subject: [PATCH 20/23] chore: `SerializeAttachments` -> `SerializeAttachmentList` --- packages/libs/error-stack/src/serde.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/libs/error-stack/src/serde.rs b/packages/libs/error-stack/src/serde.rs index 5251a0065f2..13c48200281 100644 --- a/packages/libs/error-stack/src/serde.rs +++ b/packages/libs/error-stack/src/serde.rs @@ -47,9 +47,9 @@ impl<'a> Serialize for SerializeAttachment<'a> { } } -struct SerializeAttachments<'a, 'b>(&'a [&'b Frame]); +struct SerializeAttachmentList<'a, 'b>(&'a [&'b Frame]); -impl<'a, 'b> Serialize for SerializeAttachments<'a, 'b> { +impl<'a, 'b> Serialize for SerializeAttachmentList<'a, 'b> { fn serialize(&self, serializer: S) -> Result where S: Serializer, @@ -89,7 +89,7 @@ impl<'a> Serialize for SerializeContext<'a> { let mut map = serializer.serialize_map(Some(3))?; map.serialize_entry("context", &format!("{context}"))?; - map.serialize_entry("attachments", &SerializeAttachments(&attachments[..]))?; + map.serialize_entry("attachments", &SerializeAttachmentList(&attachments[..]))?; map.serialize_entry("sources", &SerializeSources(sources))?; map.end() From 4c675645442c693dbd0877bef178c065b48bc2ff Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 18:56:28 +0100 Subject: [PATCH 21/23] docs: attribute correct type --- packages/libs/error-stack/src/serde.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/libs/error-stack/src/serde.rs b/packages/libs/error-stack/src/serde.rs index 13c48200281..20f96db9943 100644 --- a/packages/libs/error-stack/src/serde.rs +++ b/packages/libs/error-stack/src/serde.rs @@ -32,12 +32,12 @@ impl<'a> Serialize for SerializeAttachment<'a> { match frame.kind() { FrameKind::Context(_) => { // TODO: for now `Context` is unsupported, upcoming PR will fix via hooks - // `SerializeContext` ensures that no context is ever serialized + // `SerializeAttachmentList` ensures that no context is ever serialized todo!() } FrameKind::Attachment(AttachmentKind::Opaque(_)) => { // TODO: for now opaque attachments are unsupported, upcoming PR will fix that - // `SerializeContext` ensures that no such attachment is added + // `SerializeAttachmentList` ensures that no such attachment is added todo!() } FrameKind::Attachment(AttachmentKind::Printable(attachment)) => { From 763a7affe982db20c5687d6462acbd4a84ee5177 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Fri, 18 Nov 2022 19:02:14 +0100 Subject: [PATCH 22/23] chore: move `create_report` --- packages/libs/error-stack/tests/common.rs | 8 ++++---- .../tests/snapshots/test_debug__full__alt.snap | 2 +- .../tests/snapshots/test_debug__full__complex.snap | 6 +++--- .../tests/snapshots/test_debug__full__hook.snap | 2 +- .../snapshots/test_debug__full__hook_context.snap | 2 +- .../tests/snapshots/test_debug__full__hook_decr.snap | 2 +- .../test_debug__full__hook_for_context.snap | 2 +- .../tests/snapshots/test_debug__full__hook_incr.snap | 2 +- .../snapshots/test_debug__full__hook_multiple.snap | 2 +- .../snapshots/test_debug__full__hook_provider.snap | 2 +- .../tests/snapshots/test_debug__full__linear.snap | 2 +- .../snapshots/test_debug__full__linear_ext.snap | 2 +- .../tests/snapshots/test_debug__full__multiline.snap | 2 +- .../tests/snapshots/test_debug__full__norm.snap | 2 +- .../tests/snapshots/test_debug__full__sources.snap | 6 +++--- .../test_debug__full__sources_transparent.snap | 6 +++--- .../tests/snapshots/test_debug__sources_nested.snap | 12 ++++++------ ...debug__sources_nested@backtrace-pretty-print.snap | 12 ++++++------ .../test_debug__sources_nested@backtrace.snap | 12 ++++++------ .../test_debug__sources_nested@pretty-print.snap | 12 ++++++------ ...rces_nested@spantrace-backtrace-pretty-print.snap | 12 ++++++------ ...st_debug__sources_nested@spantrace-backtrace.snap | 12 ++++++------ ...debug__sources_nested@spantrace-pretty-print.snap | 12 ++++++------ .../test_debug__sources_nested@spantrace.snap | 12 ++++++------ .../test_debug__sources_nested_alternate.snap | 12 ++++++------ ...rces_nested_alternate@backtrace-pretty-print.snap | 12 ++++++------ ...st_debug__sources_nested_alternate@backtrace.snap | 12 ++++++------ ...debug__sources_nested_alternate@pretty-print.snap | 12 ++++++------ ...d_alternate@spantrace-backtrace-pretty-print.snap | 12 ++++++------ ...sources_nested_alternate@spantrace-backtrace.snap | 12 ++++++------ ...rces_nested_alternate@spantrace-pretty-print.snap | 12 ++++++------ ...st_debug__sources_nested_alternate@spantrace.snap | 12 ++++++------ 32 files changed, 121 insertions(+), 121 deletions(-) diff --git a/packages/libs/error-stack/tests/common.rs b/packages/libs/error-stack/tests/common.rs index 90d3697bb76..7e8df54eef0 100644 --- a/packages/libs/error-stack/tests/common.rs +++ b/packages/libs/error-stack/tests/common.rs @@ -1,5 +1,9 @@ #![allow(dead_code)] +pub fn create_report() -> Report { + Report::new(RootError) +} + extern crate alloc; pub use alloc::{ @@ -158,10 +162,6 @@ impl fmt::Display for PrintableC { } } -pub fn create_report() -> Report { - Report::new(RootError) -} - pub fn create_error() -> Result<(), RootError> { Err(create_report()) } diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap index d4b8a23fc67..89eca278e17 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__alt.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap index 6f01385af39..05bd3ea3cc8 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__complex.snap @@ -7,13 +7,13 @@ context A ├╴ printable A │ ╰┬▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ printable A │ ├▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -21,7 +21,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap index 37542cfd7b0..f0f36fae90b 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap index 426c54a2cfa..62fd322ff3c 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ unsigned 32bit integer (No. 0) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap index d76fb347fa1..e79081dcaea 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_decr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ -1 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap index a1944bc3531..8c55a459713 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_for_context.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ 1 additional opaque attachment diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap index d24c80d6309..0ff056d2f91 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_incr.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ 0 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap index 9c859aea964..81fbdae0b37 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_multiple.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ unsigned 32bit integer diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap index 2ebf880f025..7f8e5ff8a98 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap @@ -8,7 +8,7 @@ context D ├╴ tests/test_debug.rs:597:38 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (1) ╰╴ span trace with 2 frames (1) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap index 86c3edab9cd..451f221246f 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap index da037628445..a4d9676ffbc 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap @@ -12,7 +12,7 @@ context B │ ╰╴ 1 additional opaque attachment │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ printable A diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap index c3606f7da41..3f52e1d80b1 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__multiline.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:#?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ├╴ A multiline diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap index ee34bfb4ebd..dcf1558fb61 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__norm.snap @@ -3,7 +3,7 @@ source: tests/test_debug.rs expression: "format!(\"{report:?}\")" --- root error -├╴ tests/common.rs:162:5 +├╴ tests/common.rs:4:5 ├╴ backtrace (1) ├╴ span trace with 2 frames (1) ╰╴ Empty diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap index 790a3666de6..b54597a8270 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources.snap @@ -7,21 +7,21 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap index 8fef3fb91fa..6eac574b8ae 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap @@ -7,14 +7,14 @@ context A ├╴ 1 additional opaque attachment │ ╰┬▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ├╴ printable A │ ╰╴ 1 additional opaque attachment │ ├▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (2) │ ├╴ span trace with 2 frames (2) │ ├╴ printable B @@ -22,7 +22,7 @@ context A │ ╰╴ 1 additional opaque attachment │ ╰▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (3) ├╴ span trace with 2 frames (3) ├╴ printable B diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap index 1b74e862267..7e9621e4264 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap index e355c1020fa..64b71615067 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap index 087519540eb..1919c745fe9 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap index 3c501b77a69..289162c1c49 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:162:5 + ╰╴ tests/common.rs:4:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap index 13fa6aa89a6..b891faf04f9 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap index 99dfcb12045..3d527cfe2f6 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap index 7868366dba5..5f2ed8384dc 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap index 74c8adafd3f..2dc22d17f6e 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- span trace with 2 frames (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap index aa78eef2eb0..f4cca74e062 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- 6 | |> context A @@ -31,7 +31,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A | |- at tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |> context A |- at tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap index 1d8e929bafb..48d7d00cd05 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ backtrace (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ╰╴ backtrace (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap index 5d79458ea45..ad263f4714d 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- backtrace (6) ======================================== diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap index a1686aa0a33..18bec1adc25 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ 6 │ ╰▶ context A @@ -31,7 +31,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:186:10 @@ -42,7 +42,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:172:10 @@ -54,7 +54,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ├▶ context A │ ├╴ tests/test_debug.rs:182:10 @@ -63,7 +63,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ╰╴ tests/common.rs:162:5 + │ ╰╴ tests/common.rs:4:5 │ ╰▶ context A ├╴ tests/test_debug.rs:178:10 @@ -75,4 +75,4 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ╰╴ tests/common.rs:162:5 + ╰╴ tests/common.rs:4:5 diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap index 482cd681788..7f664c38f0d 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (1) │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 @@ -33,7 +33,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (2) │ ╰╴ span trace with 2 frames (2) │ @@ -46,7 +46,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (3) │ ╰╴ span trace with 2 frames (3) │ @@ -60,7 +60,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (4) │ ╰╴ span trace with 2 frames (4) │ @@ -71,7 +71,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ backtrace (5) │ ╰╴ span trace with 2 frames (5) │ @@ -85,7 +85,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ├╴ backtrace (6) ╰╴ span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap index 4b15f70bf3a..3b3858eaeb4 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (1) | |- span trace with 2 frames (1) | |- 6 @@ -33,7 +33,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (2) | |- span trace with 2 frames (2) | @@ -46,7 +46,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (3) | |- span trace with 2 frames (3) | @@ -60,7 +60,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (4) | |- span trace with 2 frames (4) | @@ -71,7 +71,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- backtrace (5) | |- span trace with 2 frames (5) | @@ -85,7 +85,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- backtrace (6) |- span trace with 2 frames (6) diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap index 366ef340120..ce614fd7264 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-pretty-print.snap @@ -13,7 +13,7 @@ context A │ ├╴ 3 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ├╴ span trace with 2 frames (1) │ ╰╴ 6 │ @@ -32,7 +32,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (2) │ ├▶ context A @@ -44,7 +44,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (3) │ ├▶ context A @@ -57,7 +57,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (4) │ ├▶ context A @@ -67,7 +67,7 @@ context A │ ├╴ 8 │ │ │ ╰─▶ root error - │ ├╴ tests/common.rs:162:5 + │ ├╴ tests/common.rs:4:5 │ ╰╴ span trace with 2 frames (5) │ ╰▶ context A @@ -80,7 +80,7 @@ context A │ ╰╴ tests/test_debug.rs:177:10 │ ╰─▶ root error - ├╴ tests/common.rs:162:5 + ├╴ tests/common.rs:4:5 ╰╴ span trace with 2 frames (6) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ diff --git a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap index f00ccdfd5b4..92bf1f70eac 100644 --- a/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap +++ b/packages/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap @@ -13,7 +13,7 @@ context A | |- 3 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (1) | |- 6 | @@ -32,7 +32,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (2) | |> context A @@ -44,7 +44,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (3) | |> context A @@ -57,7 +57,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (4) | |> context A @@ -67,7 +67,7 @@ context A | |- 8 | | | |-> root error - | |- at tests/common.rs:162:5 + | |- at tests/common.rs:4:5 | |- span trace with 2 frames (5) | |> context A @@ -80,7 +80,7 @@ context A | |- at tests/test_debug.rs:177:10 | |-> root error - |- at tests/common.rs:162:5 + |- at tests/common.rs:4:5 |- span trace with 2 frames (6) ======================================== From 4606aa987889b95279469c96143acafedbf06003 Mon Sep 17 00:00:00 2001 From: Bilal Mahmoud Date: Tue, 22 Nov 2022 14:14:19 +0100 Subject: [PATCH 23/23] Update packages/libs/error-stack/src/serde.rs Co-authored-by: Tim Diekmann <21277928+TimDiekmann@users.noreply.github.com> --- packages/libs/error-stack/src/serde.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/libs/error-stack/src/serde.rs b/packages/libs/error-stack/src/serde.rs index 20f96db9943..bb2d5ec4e07 100644 --- a/packages/libs/error-stack/src/serde.rs +++ b/packages/libs/error-stack/src/serde.rs @@ -8,7 +8,7 @@ //! ```json //! { //! "context": "context display output", -//! "attachments": ["all attachments leading up to this context"], +//! "attachments": ["all", "attachments", "leading", "up", "to", "this", "context"], //! "sources": [] // recursive render using `frame.sources()` //! } //! ```