Skip to content

Commit

Permalink
Merge pull request #1450 from mesg-foundation/fix/service-tx-exists
Browse files Browse the repository at this point in the history
Add more explicit error on service create
  • Loading branch information
krhubert authored Oct 31, 2019
2 parents 2386f10 + 12204f9 commit 13542a6
Showing 1 changed file with 6 additions and 0 deletions.
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 {
return nil, fmt.Errorf("service already exists: %w", err)
}
return nil, err
}
return s.Get(tx.Data)
Expand Down

0 comments on commit 13542a6

Please sign in to comment.