From 38afa507bb81b23de697be16d53048b191821a45 Mon Sep 17 00:00:00 2001 From: Mathieu Pasquet Date: Mon, 9 Oct 2017 16:25:50 +0200 Subject: [PATCH] Provide better errors messages in commandline Instead or only printing the help message, which is not always helpful. For example, when upgrading from prometheus v1, the retention time value format has changed and now only accepts one unit (e.g. "15d") where it previously allowed more complex strings (e.g. "360h0m0s"). This commit provides the error message as an explanation for the parsing failure. --- cmd/prometheus/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 45da971b4..44363346b 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -175,6 +175,7 @@ func main() { _, err := a.Parse(os.Args[1:]) if err != nil { + fmt.Fprintln(os.Stderr, errors.Wrapf(err, "Error parsing commandline arguments")) a.Usage(os.Args[1:]) os.Exit(2) }