From 010386f48d8586e20b4644627f96246af6d63c95 Mon Sep 17 00:00:00 2001 From: rigelrozanski Date: Tue, 27 Mar 2018 21:48:41 +0200 Subject: [PATCH] sprintf and fix error codes --- examples/basecoin/x/cool/errors.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/basecoin/x/cool/errors.go b/examples/basecoin/x/cool/errors.go index 707f2ef8c..5db3efc39 100644 --- a/examples/basecoin/x/cool/errors.go +++ b/examples/basecoin/x/cool/errors.go @@ -1,15 +1,17 @@ package cool import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" ) const ( - // Cool module reserves error 300-399 lawl - CodeIncorrectCoolAnswer sdk.CodeType = 300 + // Cool module reserves error 400-499 lawl + CodeIncorrectCoolAnswer sdk.CodeType = 400 ) // ErrIncorrectCoolAnswer - Error returned upon an incorrect guess func ErrIncorrectCoolAnswer(answer string) sdk.Error { - return sdk.NewError(CodeIncorrectCoolAnswer, "Incorrect cool answer") + return sdk.NewError(CodeIncorrectCoolAnswer, fmt.Sprintf("Incorrect cool answer: %v", answer)) }