Log UpdateKind::Error in dispatching2

This commit is contained in:
Hirrolot 2022-03-21 20:40:04 +06:00
parent c2c5e463fc
commit 91f8eb6acc
2 changed files with 18 additions and 1 deletions

View file

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- The `Storage::erase` default function that returns `ErasedStorage`.
- `ErasedStorage`, a storage with an erased error type.
### Fixed
- Log `UpdateKind::Error` in `teloxide::dispatching2::Dispatcher`.
## 0.7.1 - 2022-03-09
### Fixed

View file

@ -11,7 +11,10 @@ use crate::{
use dptree::di::{DependencyMap, DependencySupplier};
use futures::{future::BoxFuture, StreamExt};
use std::{collections::HashSet, fmt::Debug, ops::ControlFlow, sync::Arc};
use teloxide_core::requests::{Request, RequesterExt};
use teloxide_core::{
requests::{Request, RequesterExt},
types::UpdateKind,
};
use tokio::time::timeout;
use std::future::Future;
@ -217,6 +220,16 @@ where
{
match update {
Ok(upd) => {
if let UpdateKind::Error(err) = upd.kind {
log::error!(
"Cannot parse an update.\nError: {:?}\n\
This is a bug in teloxide-core, please open an issue here: \
https://github.com/teloxide/teloxide-core/issues.",
err,
);
return;
}
let mut deps = self.dependencies.clone();
deps.insert(upd);
deps.insert(self.bot.clone());