mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
add backtrace
This commit is contained in:
parent
09696fee69
commit
09bf7471b9
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -7327,6 +7327,7 @@ name = "storage-async"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"backtrace",
|
||||
"eth2_ssz",
|
||||
"shared_types",
|
||||
"storage",
|
||||
|
@ -11,3 +11,4 @@ task_executor = { path = "../../common/task_executor" }
|
||||
tokio = { version = "1.19.2", features = ["sync"] }
|
||||
tracing = "0.1.35"
|
||||
eth2_ssz = "0.4.0"
|
||||
backtrace = "0.3"
|
@ -2,6 +2,7 @@
|
||||
extern crate tracing;
|
||||
|
||||
use anyhow::bail;
|
||||
use backtrace::Backtrace;
|
||||
use shared_types::{
|
||||
Chunk, ChunkArray, ChunkArrayWithProof, DataRoot, FlowProof, FlowRangeProof, Transaction,
|
||||
};
|
||||
@ -148,8 +149,16 @@ impl Store {
|
||||
WORKER_TASK_NAME,
|
||||
);
|
||||
|
||||
rx.await
|
||||
.unwrap_or_else(|_| bail!(error::Error::Custom("Receiver error".to_string())))
|
||||
rx.await.unwrap_or_else(|_| {
|
||||
let mut backtrace = Backtrace::new();
|
||||
let mut frames = backtrace.frames().to_vec();
|
||||
if frames.len() > 3 {
|
||||
frames.drain(0..); //Remove the first 3 unnecessary frames to simplify// backtrace
|
||||
backtrace = frames.into();
|
||||
Some(format!("{:?}", backtrace));
|
||||
}
|
||||
bail!(error::Error::Custom("Receiver error".to_string()))
|
||||
})
|
||||
}
|
||||
|
||||
// FIXME(zz): Refactor the lock and async call here.
|
||||
|
Loading…
Reference in New Issue
Block a user