parent
817306b1ad
commit
ac05d55da9
1 changed files with 4 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/ayn2op/arikawa/v3/discord"
|
||||
"github.com/ayn2op/arikawa/v3/gateway"
|
||||
"github.com/ayn2op/arikawa/v3/utils/ws"
|
||||
"github.com/ayn2op/discordo/internal/ui"
|
||||
"github.com/ayn2op/discordo/internal/ui/chat/composer"
|
||||
"github.com/ayn2op/discordo/internal/ui/chat/guildstree"
|
||||
"github.com/ayn2op/ningen/v3"
|
||||
|
|
@ -23,10 +24,9 @@ func openState(state *ningen.State) tview.Cmd {
|
|||
if err := state.Open(context.Background()); err != nil {
|
||||
slog.Error("failed to open chat state", "err", err)
|
||||
|
||||
// A rejected token never works again, so ask for a new one.
|
||||
var event *ws.CloseEvent
|
||||
if errors.As(err, &event) && event.Code == closeCodeAuthenticationFailed {
|
||||
return LogoutMsg{}
|
||||
// A rejected token never works again, so say so over the login.
|
||||
if event, ok := errors.AsType[*ws.CloseEvent](err); ok && event.Code == closeCodeAuthenticationFailed {
|
||||
return tview.Sequence(logout(), func() tview.Msg { return ui.ErrorDialog("open chat state", err) })()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue