]> Untitled Git - lemmy.git/commitdiff
don't strip, log trace if requested (#3425)
authorphiresky <phireskyde+gh@gmail.com>
Fri, 30 Jun 2023 13:32:43 +0000 (15:32 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2023 13:32:43 +0000 (09:32 -0400)
Cargo.lock
Cargo.toml
crates/utils/src/error.rs

index 1fb6746e01250c36292326215a071ba8e8c3ace1..ba527f0ac66b5617cdf8bca4c2c112be89844da5 100644 (file)
@@ -399,6 +399,9 @@ name = "anyhow"
 version = "1.0.71"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
+dependencies = [
+ "backtrace",
+]
 
 [[package]]
 name = "argparse"
@@ -2590,6 +2593,7 @@ dependencies = [
  "tokio",
  "tracing",
  "uuid",
+ "wav",
 ]
 
 [[package]]
@@ -4445,6 +4449,12 @@ dependencies = [
  "bytemuck",
 ]
 
+[[package]]
+name = "riff"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9b1a3d5f46d53f4a3478e2be4a5a5ce5108ea58b100dcd139830eae7f79a3a1"
+
 [[package]]
 name = "ring"
 version = "0.16.20"
@@ -6256,6 +6266,15 @@ dependencies = [
  "web-sys",
 ]
 
+[[package]]
+name = "wav"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a65e199c799848b4f997072aa4d673c034f80f40191f97fe2f0a23f410be1609"
+dependencies = [
+ "riff",
+]
+
 [[package]]
 name = "web-sys"
 version = "0.3.60"
index 6fbd91d1be483f8eebe776dcbc77532323323cdf..e7ab77090da9e397fc2544041a591312e4840382 100644 (file)
@@ -21,14 +21,9 @@ repository.workspace = true
 doctest = false
 
 [profile.release]
-strip = "symbols"
 debug = 0
 lto = "thin"
 
-[profile.dev]
-strip = "symbols"
-debug = 0
-
 [features]
 embed-pictrs = ["pict-rs"]
 console = ["console-subscriber", "opentelemetry", "opentelemetry-otlp", "tracing-opentelemetry", "reqwest-tracing/opentelemetry_0_16"]
@@ -85,7 +80,7 @@ base64 = "0.13.1"
 uuid = { version = "1.3.4", features = ["serde", "v4"] }
 async-trait = "0.1.68"
 captcha = "0.0.9"
-anyhow = "1.0.71"
+anyhow = { version = "1.0.71", features = ["backtrace"] } # backtrace is on by default on nightly, but not stable rust
 diesel_ltree = "0.3.0"
 typed-builder = "0.10.0"
 serial_test = "0.9.0"
index 1aa3e1c62623fcc9ec0a6526cfd8b400457e948f..c89e84dbb753f69799cfc64a77359e40ee4f54dd 100644 (file)
@@ -90,7 +90,11 @@ impl Display for LemmyError {
     if let Some(message) = &self.message {
       write!(f, "{message}: ")?;
     }
-    writeln!(f, "{}", self.inner)?;
+    // print anyhow including trace
+    // https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations
+    // this will print the anyhow trace (only if it exists)
+    // and if RUST_BACKTRACE=1, also a full backtrace
+    writeln!(f, "{:?}", self.inner)?;
     fmt::Display::fmt(&self.context, f)
   }
 }