Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpful error message when flag is missing values #310

Merged
merged 2 commits into from Jun 11, 2022

Conversation

pyqlsa
Copy link
Contributor

@pyqlsa pyqlsa commented Jun 11, 2022

Intended to address #277.

mapper.go Outdated
var childScanner *Scanner
if ctx.Value.Flag != nil {
t := ctx.Scan.Pop()
// If decoding a flag, we need an argument.
if t.IsEOL() {
return errors.New("unexpected EOL")
return fmt.Errorf("missing argument: expecting \"<key>=<value>%c...\"", mapsep)
Copy link
Owner

@alecthomas alecthomas Jun 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome thank you, just two minor things.

  1. Please replace "argument" with "value", as "argument" has an existing, different, meaning.
  2. Please change "value: expecting" to "value, expecting"

@alecthomas alecthomas merged commit edc47eb into alecthomas:master Jun 11, 2022
2 checks passed
@alecthomas
Copy link
Owner

alecthomas commented Jun 11, 2022

Lovely, thank you!

@pyqlsa pyqlsa deleted the sliske/msgs branch Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants