Merge PR #2462: Add swagger-ui for gov, stake and slashing

This commit is contained in:
HaoyangLiu
2018-10-24 15:19:48 +02:00
committed by Christopher Goes
parent f756b40a01
commit 9ee9e28439
21 changed files with 1411 additions and 213 deletions
+8 -1
View File
@@ -11,6 +11,7 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
authtxb "github.com/cosmos/cosmos-sdk/x/auth/client/txbuilder"
@@ -229,9 +230,15 @@ func CompleteAndBroadcastTxREST(w http.ResponseWriter, r *http.Request, cliCtx c
}
txBytes, err := txBldr.BuildAndSign(baseReq.Name, baseReq.Password, msgs)
if err != nil {
if keyerror.IsErrKeyNotFound(err) {
WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
} else if keyerror.IsErrWrongPassword(err) {
WriteErrorResponse(w, http.StatusUnauthorized, err.Error())
return
} else if err != nil {
WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
res, err := cliCtx.BroadcastTx(txBytes)