From ac05d55da95de7f3e18eb21ad56c037e11646c16 Mon Sep 17 00:00:00 2001 From: ayn2op Date: Mon, 12 Oct 2026 12:53:27 -0400 Subject: [PATCH] fix(chat): show a dialog when the token is rejected Closes #685 --- internal/ui/chat/msg.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/ui/chat/msg.go b/internal/ui/chat/msg.go index 47a7934..4b33aab 100644 --- a/internal/ui/chat/msg.go +++ b/internal/ui/chat/msg.go @@ -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) })() } }