Skip to content

Commit

Permalink
refactor(WrapContext): do not wrap context if it's invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaliy-ukiru committed Jun 9, 2024
1 parent 54836c5 commit 1509855
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ func (m *Manager) runHandler(c tele.Context, handler Handler) error {
// FSM will unwrap this context in internal mechanic.
func (m *Manager) WrapContext(next tele.HandlerFunc) tele.HandlerFunc {
return func(c tele.Context) error {
ctx := newWrapperContext(c, m.NewContext(c))
return next(ctx)
fsmCtx, ok := m.NewContext(c)
if ok {
c = newWrapperContext(c, fsmCtx)
}
return next(c)
}
}

Expand Down

0 comments on commit 1509855

Please sign in to comment.