mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-23 11:53:05 +03:00
improved error messages
This commit is contained in:
parent
52c168e7b9
commit
8a69aeb0b1
@ -1,5 +1,7 @@
|
||||
use clap::{Arg, Command};
|
||||
use kinode_process_lib::{await_next_request_body, call_init, println, Address, Request, Response};
|
||||
use kinode_process_lib::{
|
||||
await_next_request_body, call_init, println, Address, Request, Response, SendErrorKind,
|
||||
};
|
||||
use regex::Regex;
|
||||
|
||||
wit_bindgen::generate!({
|
||||
@ -81,7 +83,13 @@ fn init(_our: Address) {
|
||||
let _ = Response::new().body(res.body()).send();
|
||||
}
|
||||
Err(e) => {
|
||||
println!("m: SendError: {:?}", e.kind);
|
||||
println!(
|
||||
"m: failed to send message {}",
|
||||
match e.kind {
|
||||
SendErrorKind::Timeout => "due to timeout",
|
||||
SendErrorKind::Offline => "because the target is offline",
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -917,8 +917,12 @@ pub async fn kernel(
|
||||
.send(t::Printout {
|
||||
verbosity: 0,
|
||||
content: format!(
|
||||
"event loop: don't have {} amongst registered processes (got net error for it)",
|
||||
"event loop: {} failed to deliver a message {}; sender has already terminated",
|
||||
wrapped_network_error.source.process,
|
||||
match wrapped_network_error.error.kind {
|
||||
t::SendErrorKind::Timeout => "due to timeout",
|
||||
t::SendErrorKind::Offline => "because the receiver is offline",
|
||||
},
|
||||
)
|
||||
})
|
||||
.await;
|
||||
@ -977,7 +981,11 @@ pub async fn kernel(
|
||||
.send(t::Printout {
|
||||
verbosity: 0,
|
||||
content: format!(
|
||||
"event loop: don't have {} amongst registered processes (got message for it from network)",
|
||||
"event loop: got {} from network for {}, but process does not exist (perhaps it terminated)",
|
||||
match kernel_message.message {
|
||||
t::Message::Request(_) => "Request",
|
||||
t::Message::Response(_) => "Response",
|
||||
},
|
||||
kernel_message.target.process,
|
||||
)
|
||||
})
|
||||
@ -1093,7 +1101,12 @@ pub async fn kernel(
|
||||
.send(t::Printout {
|
||||
verbosity: 0,
|
||||
content: format!(
|
||||
"event loop: don't have {:?} amongst registered processes, got message for it: {}",
|
||||
"event loop: got {} from {:?} for {:?}, but target doesn't exist (perhaps it terminated): {}",
|
||||
match kernel_message.message {
|
||||
t::Message::Request(_) => "Request",
|
||||
t::Message::Response(_) => "Response",
|
||||
},
|
||||
kernel_message.source.process,
|
||||
kernel_message.target.process,
|
||||
kernel_message,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user