Bubble errors instead of panicking (#194)

This commit is contained in:
Simon Frei
2021-08-19 10:00:53 +02:00
committed by GitHub
parent f547618963
commit 5a9c9c7864
7 changed files with 90 additions and 85 deletions
-2
View File
@@ -653,7 +653,6 @@ func (c *Context) Apply() (string, error) {
}
func (c *Context) parseFlag(flags []*Flag, match string) (err error) {
defer catch(&err)
candidates := []string{}
for _, flag := range flags {
long := "--" + flag.Name
@@ -734,7 +733,6 @@ func (c *Context) RunNode(node *Node, binds ...interface{}) (err error) {
// Any passed values will be bindable to arguments of the target Run() method. Additionally,
// all parent nodes in the command structure will be bound.
func (c *Context) Run(binds ...interface{}) (err error) {
defer catch(&err)
node := c.Selected()
if node == nil {
return fmt.Errorf("no command selected")