[#390] cli: Make tree commands errors and messages more verbose

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-07-11 12:36:33 +03:00 committed by Evgenii Stratonikov
parent c42db4e761
commit 676a3efa79
8 changed files with 30 additions and 29 deletions

View file

@ -53,7 +53,7 @@ func addByPath(cmd *cobra.Command, _ []string) {
ctx := cmd.Context()
cli, err := _client(ctx)
commonCmd.ExitOnErr(cmd, "client: %w", err)
commonCmd.ExitOnErr(cmd, "failed to create client: %w", err)
rawCID := make([]byte, sha256.Size)
cnr.Encode(rawCID)
@ -74,10 +74,10 @@ func addByPath(cmd *cobra.Command, _ []string) {
BearerToken: common.ReadBearerToken(cmd, bearerFlagKey).Marshal(),
}
commonCmd.ExitOnErr(cmd, "message signing: %w", tree.SignMessage(req, pk))
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
resp, err := cli.AddByPath(ctx, req)
commonCmd.ExitOnErr(cmd, "rpc call: %w", err)
commonCmd.ExitOnErr(cmd, "failed to addByPath %w", err)
cmd.Printf("Parent ID: %d\n", resp.GetBody().GetParentId())