sachaos / todoist

Todoist CLI Client. I ❤️ Todoist and CLI.
MIT License
1.48k stars 105 forks source link

Harsh error handling on nonexistent task id #14

Closed ocelotsloth closed 7 years ago

ocelotsloth commented 7 years ago

The error handling could stand to be a bit more graceful than a full panic when you give an invalid task id.

Demonstrated below:


~ ❯❯❯ todoist show 2                                                                                                                                             ⏎
panic: interface conversion: todoist.IDCarrier is nil, not todoist.Item

goroutine 1 [running]:
main.Show(0xc420087340, 0x0, 0x0)
    /home/ocelotsloth/.cache/pacaur/todoist/src/todoist-0.9.1/show.go:20 +0xefd
github.com/urfave/cli.HandleAction(0x7ea120, 0x887be0, 0xc420087340, 0xc42006c600, 0x0)
    /home/ocelotsloth/.cache/pacaur/todoist/src/go/src/github.com/urfave/cli/app.go:490 +0xd4
github.com/urfave/cli.Command.Run(0x86cfbc, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x874af4, 0x10, 0x0, ...)
    /home/ocelotsloth/.cache/pacaur/todoist/src/go/src/github.com/urfave/cli/command.go:210 +0xb6e
github.com/urfave/cli.(*App).Run(0xc4200de680, 0xc4200101b0, 0x3, 0x3, 0x0, 0x0)
    /home/ocelotsloth/.cache/pacaur/todoist/src/go/src/github.com/urfave/cli/app.go:255 +0x76f
main.main()
    /home/ocelotsloth/.cache/pacaur/todoist/src/todoist-0.9.1/main.go:226 +0x11cf
~ ❯❯❯ todoist show 2274599906                                                                                                                                    ⏎
ID       2274599906
Content  Make breakfast
Project  #Inbox
Labels   
Priority p4
DueDate  17/07/29(Sat)
URL      
~ ❯❯❯
sachaos commented 7 years ago

@ocelotsloth Thank you for your feedback. Yes, I think so too. I'll fix it soon.