cli: Add context to policy parsing errors #683

Merged
fyrchik merged 1 commit from fyrchik/frostfs-node:parsing-error into master 2023-09-12 09:47:22 +00:00
Owner

Signed-off-by: Evgenii Stratonikov e.stratonikov@yadro.com

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
fyrchik force-pushed parsing-error from f50137da3a to 97bb1bf36f 2023-09-12 07:47:04 +00:00 Compare
fyrchik requested review from storage-core-committers 2023-09-12 07:47:12 +00:00
fyrchik requested review from storage-core-developers 2023-09-12 07:47:58 +00:00
fyrchik added this to the v0.37.0 milestone 2023-09-12 07:48:01 +00:00
aarifullin reviewed 2023-09-12 07:52:51 +00:00
@ -186,3 +186,3 @@
}
if err = result.UnmarshalJSON([]byte(policyString)); err == nil {
if err := result.UnmarshalJSON([]byte(policyString)); err == nil {
Member

It looks unnatural for Go language :)

Can you swap these lines please

if err := result.UnmarshalJSON([]byte(policyString)); err != nil {
   return nil, fmt.Errorf("can't parse placement policy: %w", err)
}

common.PrintVerbose(cmd, "Parsed JSON encoded policy")
return &result, nil
It looks unnatural for Go language :) Can you swap these lines please ```golang if err := result.UnmarshalJSON([]byte(policyString)); err != nil { return nil, fmt.Errorf("can't parse placement policy: %w", err) } common.PrintVerbose(cmd, "Parsed JSON encoded policy") return &result, nil ```
Author
Owner

It will become incorrect then -- we intentionally return an error from DecodeString

It will become incorrect then -- we intentionally return an error from `DecodeString`
Member

ah, ok

ah, ok
acid-ant approved these changes 2023-09-12 08:57:16 +00:00
aarifullin approved these changes 2023-09-12 09:44:54 +00:00
fyrchik merged commit 58239d1b2c into master 2023-09-12 09:47:22 +00:00
fyrchik deleted branch parsing-error 2023-09-12 09:47:22 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#683
No description provided.