Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more explicit error on service create #1450

Merged
merged 2 commits into from
Oct 31, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sdk/service/sdk.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package servicesdk

import (
"fmt"

"github.com/cosmos/cosmos-sdk/codec"
cosmostypes "github.com/cosmos/cosmos-sdk/types"
"github.com/gogo/protobuf/proto"
Expand All @@ -10,6 +12,7 @@ import (
accountsdk "github.com/mesg-foundation/engine/sdk/account"
"github.com/mesg-foundation/engine/service"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/mempool"
)

// SDK is the service sdk.
Expand Down Expand Up @@ -44,6 +47,9 @@ func (s *SDK) Create(req *api.CreateServiceRequest, accountName, accountPassword
msg := newMsgCreateService(s.cdc, req, owner)
tx, err := s.client.BuildAndBroadcastMsg(msg, accountName, accountPassword, accNumber, accSeq)
if err != nil {
if err == mempool.ErrTxInCache {
NicolasMahe marked this conversation as resolved.
Show resolved Hide resolved
return nil, fmt.Errorf("service already exists: %w", err)
}
return nil, err
}
return s.Get(tx.Data)
Expand Down