Skip to content

--maphost discards its own specific parse error #26

Description

@korya

Problem

parseHostMappings produces precise diagnostics:

  • value %q has no separator, =
  • value %q has no src port %q
  • value %q has invalid src port %q
  • value %q has invalid dst port %q

mustParseHostMappings throws all of them away and prints the raw slice instead.

Reproduction

$ http-assert --maphost 'garbage' --assert-ok http://127.0.0.1:8791/ok
Error: Invalid value for --maphost flag: [garbage]
[exit=71]

Expected something like:

Error: Invalid value for --maphost flag: value "garbage" has no separator, =

Affected code

main.gomustParseHostMappings (the err return is ignored)

Suggested fix

Include err in the die format string. One-line change, free UX win.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions