Add error unwrapping

This commit is contained in:
mcrakhman 2023-03-06 09:41:45 +01:00 committed by Mikhail Iudin
parent 1210b9d21a
commit dea506aa42
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0

View File

@ -7,6 +7,7 @@ import (
"github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto" "github.com/anytypeio/any-sync/commonspace/object/tree/treechangeproto"
"github.com/anytypeio/any-sync/coordinator/coordinatorproto" "github.com/anytypeio/any-sync/coordinator/coordinatorproto"
"github.com/anytypeio/any-sync/net/pool" "github.com/anytypeio/any-sync/net/pool"
"github.com/anytypeio/any-sync/net/rpc/rpcerr"
"github.com/anytypeio/any-sync/nodeconf" "github.com/anytypeio/any-sync/nodeconf"
) )
@ -40,6 +41,7 @@ func (c *coordinatorClient) ChangeStatus(ctx context.Context, spaceId string, de
DeletionChangePayload: deleteRaw.GetRawChange(), DeletionChangePayload: deleteRaw.GetRawChange(),
}) })
if err != nil { if err != nil {
err = rpcerr.Unwrap(err)
return return
} }
status = resp.Payload status = resp.Payload
@ -55,6 +57,7 @@ func (c *coordinatorClient) StatusCheck(ctx context.Context, spaceId string) (st
SpaceId: spaceId, SpaceId: spaceId,
}) })
if err != nil { if err != nil {
err = rpcerr.Unwrap(err)
return return
} }
status = resp.Payload status = resp.Payload
@ -81,6 +84,7 @@ func (c *coordinatorClient) SpaceSign(ctx context.Context, spaceId string, space
Header: spaceHeader, Header: spaceHeader,
}) })
if err != nil { if err != nil {
err = rpcerr.Unwrap(err)
return return
} }
return resp.Receipt, nil return resp.Receipt, nil
@ -96,6 +100,7 @@ func (c *coordinatorClient) FileLimitCheck(ctx context.Context, spaceId string,
SpaceId: spaceId, SpaceId: spaceId,
}) })
if err != nil { if err != nil {
err = rpcerr.Unwrap(err)
return return
} }
return resp.Limit, nil return resp.Limit, nil