summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-02-05 23:33:52 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-02-05 23:33:52 +0100
commit875a9f93e6616ddb8a71238149eb1384ca177191 (patch)
tree75a51fed54beecd0b3f14d0f8a6bbb2fc69ef48c
parent486a6963e468f3d0c9e92b20f6abafc6b6ddfaba (diff)
downloadhepi-875a9f93e6616ddb8a71238149eb1384ca177191.tar.gz
Add validation to require group or request flags and improve error messages for request decoding failures
-rw-r--r--main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.go b/main.go
index aede524..38ad6b8 100644
--- a/main.go
+++ b/main.go
@@ -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)
}