vegapokerbot/internal/handler/wizard/error_state.go

22 lines
522 B
Go
Raw Normal View History

2024-05-13 16:57:55 +03:00
package wizard
import (
"gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/fsm"
"go.uber.org/zap"
)
type ErrorState struct {
fsm.ErrorState[Wizard]
log *zap.SugaredLogger
}
func NewErrorState(log *zap.SugaredLogger) *ErrorState {
return &ErrorState{log: log}
}
func (s *ErrorState) Handle(err error, cur fsm.StateID, next fsm.StateID, pl *Wizard, mc fsm.MachineControls[*Wizard]) {
s.log.Errorf("critical wizard error: %s, current state: %s, next state: %s, payload: %#v",
err, cur, next, pl)
mc.Reset()
}