mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-06-30 12:33:31 +00:00
Display captured backtrace when available (#2504)
* Display captured backtrace when available * Helpful log message
This commit is contained in:
parent
ef1be196c1
commit
76bb317201
|
@ -260,7 +260,7 @@ async fn main() -> tauri::Result<()> {
|
|||
|
||||
handle.windows().iter().for_each(|(_, window)| {
|
||||
if should_clear_localstorage {
|
||||
println!("bruh?");
|
||||
println!("cleaning localStorage");
|
||||
for webview in window.webviews() {
|
||||
webview.eval("localStorage.clear();").ok();
|
||||
}
|
||||
|
|
|
@ -212,8 +212,6 @@ impl Node {
|
|||
"info"
|
||||
};
|
||||
|
||||
// let level = "debug"; // Exists for now to debug the location manager
|
||||
|
||||
std::env::set_var(
|
||||
"RUST_LOG",
|
||||
format!("info,sd_core={level},sd_p2p=debug,sd_core::location::manager=info,sd_ai={level}"),
|
||||
|
@ -239,12 +237,20 @@ impl Node {
|
|||
.init();
|
||||
|
||||
std::panic::set_hook(Box::new(move |panic| {
|
||||
use std::backtrace::{Backtrace, BacktraceStatus};
|
||||
let backtrace = Backtrace::capture();
|
||||
if let Some(location) = panic.location() {
|
||||
tracing::error!(
|
||||
message = %panic,
|
||||
panic.file = format!("{}:{}", location.file(), location.line()),
|
||||
panic.column = location.column(),
|
||||
);
|
||||
if backtrace.status() == BacktraceStatus::Captured {
|
||||
// NOTE(matheus-consoli): it seems that `tauri` is messing up the stack-trace
|
||||
// and it doesn't capture anything, even when `RUST_BACKTRACE=full`,
|
||||
// so in the current architecture, this is emitting an empty event.
|
||||
tracing::error!(message = %backtrace);
|
||||
}
|
||||
} else {
|
||||
tracing::error!(message = %panic);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue