mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-24 22:57:12 -04:00
chore: print duplicate event erorr
This commit is contained in:
parent
e8bb6f0a7f
commit
b29f53c995
11 changed files with 35 additions and 24 deletions
|
@ -47,8 +47,17 @@ where
|
|||
T: std::convert::TryFrom<Bytes, Error = protobuf::ProtobufError>,
|
||||
{
|
||||
fn parse_from_bytes(bytes: Bytes) -> Result<Self, DispatchError> {
|
||||
let data = T::try_from(bytes)?;
|
||||
Ok(data)
|
||||
match T::try_from(bytes) {
|
||||
Ok(data) => Ok(data),
|
||||
Err(e) => {
|
||||
tracing::error!(
|
||||
"Parse payload to {} failed with error: {:?}",
|
||||
std::any::type_name::<T>(),
|
||||
e
|
||||
);
|
||||
Err(e.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,13 +139,14 @@ impl Service<DispatchContext> for DispatchService {
|
|||
// print_module_map_info(&module_map);
|
||||
match module_map.get(&request.event) {
|
||||
Some(module) => {
|
||||
tracing::trace!("Handle event: {:?} by {:?}", &request.event, module.name);
|
||||
let fut = module.new_service(());
|
||||
let service_fut = fut.await?.call(request);
|
||||
service_fut.await
|
||||
}
|
||||
None => {
|
||||
let msg = format!("Can not find the event handler. {:?}", request);
|
||||
log::error!("{}", msg);
|
||||
tracing::error!("{}", msg);
|
||||
Err(InternalError::HandleNotFound(msg).into())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue