diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-02-05 23:33:52 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-02-05 23:33:52 +0100 |
| commit | 875a9f93e6616ddb8a71238149eb1384ca177191 (patch) | |
| tree | 75a51fed54beecd0b3f14d0f8a6bbb2fc69ef48c /main.go | |
| parent | 486a6963e468f3d0c9e92b20f6abafc6b6ddfaba (diff) | |
| download | hepi-875a9f93e6616ddb8a71238149eb1384ca177191.tar.gz | |
Add validation to require group or request flags and improve error messages for request decoding failures
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -94,6 +94,12 @@ func main() { } runner.ShowHeaders = *showHeaders + if *groupName == "" && *reqNames == "" { + fmt.Printf("Error: -group or -req is required\n\n") + runner.PrintHelp() + os.Exit(0) + } + if envName == "" { runner.PrintHelp() return @@ -203,6 +209,9 @@ func (r *Runner) ExecuteRequests(reqNames string) error { var req Request if err := valNode.Decode(&req); err != nil { + if strings.Contains(err.Error(), "invalid map key") { + return fmt.Errorf("%sfailed to decode request %q: %w\n%sHint: Check for unquoted template variables like {{foo}} used as values%s", colorRed, name, err, colorYellow, colorReset) + } return fmt.Errorf("%sfailed to decode request %q: %w%s", colorRed, name, err, colorReset) } |
