mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 15:01:45 +01:00
Refactor Dispatcher
This commit is contained in:
parent
7d6c374828
commit
cd51bba180
1 changed files with 2 additions and 6 deletions
|
@ -199,18 +199,14 @@ where
|
||||||
let mut deps = self.dependencies.clone();
|
let mut deps = self.dependencies.clone();
|
||||||
deps.insert(upd);
|
deps.insert(upd);
|
||||||
deps.insert(self.requester.clone());
|
deps.insert(self.requester.clone());
|
||||||
|
|
||||||
match self.handler.dispatch(deps).await {
|
match self.handler.dispatch(deps).await {
|
||||||
ControlFlow::Break(Ok(())) => {}
|
ControlFlow::Break(Ok(())) => {}
|
||||||
ControlFlow::Break(Err(err)) => {
|
ControlFlow::Break(Err(err)) => {
|
||||||
self.error_handler.clone().handle_error(err).await
|
self.error_handler.clone().handle_error(err).await
|
||||||
}
|
}
|
||||||
ControlFlow::Continue(deps) => {
|
ControlFlow::Continue(deps) => {
|
||||||
match self
|
match self.default_handler.clone().dispatch(deps).await {
|
||||||
.default_handler
|
|
||||||
.clone()
|
|
||||||
.execute(deps, |next| async move { match next {} })
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
ControlFlow::Break(()) => {}
|
ControlFlow::Break(()) => {}
|
||||||
ControlFlow::Continue(_) => unreachable!(
|
ControlFlow::Continue(_) => unreachable!(
|
||||||
"This is unreachable due to Infallible type in the DefaultHandler \
|
"This is unreachable due to Infallible type in the DefaultHandler \
|
||||||
|
|
Loading…
Reference in a new issue