some compiler lib cleanup

This commit is contained in:
gluax 2022-06-08 10:50:23 -07:00
parent d43fd813f7
commit 5129276a4b
2 changed files with 12 additions and 2 deletions

View File

@ -17,6 +17,9 @@ include = [ "Cargo.toml", "src", "README.md", "LICENSE.md" ]
license = "GPL-3.0"
edition = "2018"
[dependencies]
backtrace = "0.3.65"
[dependencies.serde]
version = "1.0"
features = [ "derive" ]
@ -64,4 +67,4 @@ path = "../../leo/errors"
version = "1.5.3"
[dependencies.regex]
version = "1.5"
version = "1.5"

View File

@ -57,7 +57,14 @@ fn set_hook() -> Arc<Mutex<Option<String>>> {
let panic_buf = panic_buf.clone();
Box::new(move |e| {
if thread::current().id() == thread_id {
*panic_buf.lock().unwrap() = Some(e.to_string());
if !std::env::var("RUST_BACKTRACE")
.unwrap_or_else(|_| "".to_string())
.is_empty()
{
*panic_buf.lock().unwrap() = Some(format!("{:?}", backtrace::Backtrace::new()));
} else {
*panic_buf.lock().unwrap() = Some(e.to_string());
}
} else {
println!("{}", e)
}