From a941e66e98511b8c72877e5639ea7970ec82a3d5 Mon Sep 17 00:00:00 2001 From: Lev Berman Date: Mon, 21 Sep 2015 14:15:14 +0300 Subject: [PATCH] Clarify an error message a bit --- parser/argument_parser.go | 2 +- parser/argument_parser_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/parser/argument_parser.go b/parser/argument_parser.go index d53ec2c..6d38683 100644 --- a/parser/argument_parser.go +++ b/parser/argument_parser.go @@ -49,7 +49,7 @@ func ParseArguments(args []string) (res map[string]interface{}, err error) { if err != nil { parsedArg, err = ParseObject(args[i]) if err != nil { - return nil, fmt.Errorf("%s is neither a JSON object nor an object in a=b,c=d.. format.", args[i]) + return nil, fmt.Errorf("%s is neither a valid JSON object nor a valid object in a=b,c=d.. format.", args[i]) } } else { NormalizeKeys(parsedArg) diff --git a/parser/argument_parser_test.go b/parser/argument_parser_test.go index 3c21129..3e11987 100644 --- a/parser/argument_parser_test.go +++ b/parser/argument_parser_test.go @@ -37,7 +37,7 @@ var testCases = []parserTestParam{ {input: []string{"--some-key", "value1", "--some-key", "value2"}, err: "Option 'SomeKey' is specified twice."}, {input: []string{`{"some-key": "value"}`, "--some-key", "value2"}, err: "Option 'SomeKey' is specified twice."}, // Does not parse root values not in JSON or a=b,c=d,.. format. - {input: []string{"value", "value2"}, err: "value is neither a JSON object nor an object in a=b,c=d.. format."}, + {input: []string{"value", "value2"}, err: "value is neither a valid JSON object nor a valid object in a=b,c=d.. format."}, // Parses top-level objects in JSON and a=b,c=d,.. format. {input: []string{"key-one=value1,key-two=value2", `{"key-three":"value3"}`}, res: map[string]interface{}{ "KeyOne": "value1",