[#683] cli: Add context to policy parsing errors

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-09-12 10:44:43 +03:00 committed by Evgenii Stratonikov
parent 3c76884182
commit 58239d1b2c

View file

@ -185,12 +185,12 @@ func parseContainerPolicy(cmd *cobra.Command, policyString string) (*netmap.Plac
return &result, nil return &result, nil
} }
if err = result.UnmarshalJSON([]byte(policyString)); err == nil { if err := result.UnmarshalJSON([]byte(policyString)); err == nil {
common.PrintVerbose(cmd, "Parsed JSON encoded policy") common.PrintVerbose(cmd, "Parsed JSON encoded policy")
return &result, nil return &result, nil
} }
return nil, errors.New("can't parse placement policy") return nil, fmt.Errorf("can't parse placement policy: %w", err)
} }
func parseAttributes(dst *container.Container, attributes []string) error { func parseAttributes(dst *container.Container, attributes []string) error {