1
0
Fork 0

Fixed error handling TODOs

This commit is contained in:
マリウス 2023-01-05 00:25:20 -05:00
parent e9fb93da7b
commit 9766f268c6
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
1 changed files with 18 additions and 3 deletions

View File

@ -34,13 +34,28 @@ func handleReply(mi interface{}) (bool, []tea.Cmd) {
if m.buffer != "" {
replyToIdx, err = strconv.Atoi(m.buffer)
if err != nil {
// TODO: Handle error
cmds = append(cmds, cmd.New(
cmd.MsgError,
WIN_ID,
cmd.Arg{
Name: "error",
Value: err,
},
).Tea())
return true, cmds
}
if replyToIdx >= len(m.replyIDs) {
// TODO: Handle error
cmds = append(cmds, cmd.New(
cmd.MsgError,
WIN_ID,
cmd.Arg{
Name: "error",
Value: errors.New("Reply # does not exist!"),
},
).Tea())
return true, cmds
}
}