Skip to content

Commit

Permalink
Merge pull request #77 from groutr/panic_info
Browse files Browse the repository at this point in the history
Add useful info to AddPositionalValue panic.
  • Loading branch information
Eric Greer committed Apr 23, 2022
2 parents 1ae79a1 + 1787760 commit 1465b3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subCommand.go
Expand Up @@ -656,14 +656,14 @@ func (sc *Subcommand) AddPositionalValue(assignmentVar *string, name string, rel
// ensure no other positionals are at this depth
for _, other := range sc.PositionalFlags {
if relativePosition == other.Position {
log.Panicln("Unable to add positional value because one already exists at position: " + strconv.Itoa(relativePosition))
log.Panicln("Unable to add positional value " + name + " because " + other.Name + " already exists at position: " + strconv.Itoa(relativePosition))
}
}

// ensure no subcommands at this depth
for _, other := range sc.Subcommands {
if relativePosition == other.Position {
log.Panicln("Unable to add positional value a subcommand already exists at position: " + strconv.Itoa(relativePosition))
log.Panicln("Unable to add positional value " + name + "because a subcommand, " + other.Name + ", already exists at position: " + strconv.Itoa(relativePosition))
}
}

Expand Down

0 comments on commit 1465b3f

Please sign in to comment.