69333ec1b3
* Fixed circleci config and fixed linting warnings * Updated circleCI for go version 1.12 and split jobs for build/testing * updated go version to 1.12.5 for circleCI * Go mod tidy dependencies * Updated linting tools and cleared up code lint smells * Added workflow to run build and test jobs * Moved linting command to build workflow * Get dependencies before linting by default * Added go module flag to linter and increased deadline to pull packages
39 lines
988 B
Go
39 lines
988 B
Go
package types
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
// Ethermint error codes
|
|
const (
|
|
// DefaultCodespace reserves a Codespace for Ethermint.
|
|
DefaultCodespace sdk.CodespaceType = "ethermint"
|
|
|
|
CodeInvalidValue sdk.CodeType = 1
|
|
CodeInvalidChainID sdk.CodeType = 2
|
|
)
|
|
|
|
// CodeToDefaultMsg takes the CodeType variable and returns the error string
|
|
func CodeToDefaultMsg(code sdk.CodeType) string {
|
|
switch code {
|
|
case CodeInvalidValue:
|
|
return "invalid value"
|
|
case CodeInvalidChainID:
|
|
return "invalid chain ID"
|
|
default:
|
|
return sdk.CodeToDefaultMsg(code)
|
|
}
|
|
}
|
|
|
|
// ErrInvalidValue returns a standardized SDK error resulting from an invalid
|
|
// value.
|
|
func ErrInvalidValue(msg string) sdk.Error {
|
|
return sdk.NewError(DefaultCodespace, CodeInvalidValue, msg)
|
|
}
|
|
|
|
// ErrInvalidChainID returns a standardized SDK error resulting from an invalid
|
|
// chain ID.
|
|
func ErrInvalidChainID(msg string) sdk.Error {
|
|
return sdk.NewError(DefaultCodespace, CodeInvalidChainID, msg)
|
|
}
|