diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-08 20:32:57 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-08 20:32:57 +0200 |
| commit | fde04bbf85ea641a33a282b354d63f227f9945fb (patch) | |
| tree | 8b71df5743546e937f5c89977f0f8e0a1814bf56 /internal/tui/util | |
| parent | 124bd57c507fdcbb56ab27137cbe892f12e1b48f (diff) | |
| parent | 4385fb321903f335097119349aa1ebf9edb3f71a (diff) | |
| download | opencode-fde04bbf85ea641a33a282b354d63f227f9945fb.tar.gz opencode-fde04bbf85ea641a33a282b354d63f227f9945fb.zip | |
Merge pull request #22 from adamdottv/adam/retries
fix(anthropic): better 429/529 handling
Diffstat (limited to 'internal/tui/util')
| -rw-r--r-- | internal/tui/util/util.go | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/internal/tui/util/util.go b/internal/tui/util/util.go index f6cf20d60..e006cbb43 100644 --- a/internal/tui/util/util.go +++ b/internal/tui/util/util.go @@ -9,12 +9,39 @@ func CmdHandler(msg tea.Msg) tea.Cmd { } func ReportError(err error) tea.Cmd { - return CmdHandler(ErrorMsg(err)) + return CmdHandler(InfoMsg{ + Type: InfoTypeError, + Msg: err.Error(), + }) +} + +type InfoType int + +const ( + InfoTypeInfo InfoType = iota + InfoTypeWarn + InfoTypeError +) + +func ReportInfo(info string) tea.Cmd { + return CmdHandler(InfoMsg{ + Type: InfoTypeInfo, + Msg: info, + }) +} + +func ReportWarn(warn string) tea.Cmd { + return CmdHandler(InfoMsg{ + Type: InfoTypeWarn, + Msg: warn, + }) } type ( - InfoMsg string - ErrorMsg error + InfoMsg struct { + Type InfoType + Msg string + } ClearStatusMsg struct{} ) |
