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

Increment x/wasm error codes by 1 #276

Merged
merged 1 commit into from
Oct 6, 2020
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
30 changes: 16 additions & 14 deletions x/wasm/internal/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,47 @@ import (
var (
DefaultCodespace = ModuleName

// Note: never use code 1 for any errors - that is reserved for ErrInternal in the core cosmos sdk

// ErrCreateFailed error for wasm code that has already been uploaded or failed
ErrCreateFailed = sdkErrors.Register(DefaultCodespace, 1, "create wasm contract failed")
ErrCreateFailed = sdkErrors.Register(DefaultCodespace, 2, "create wasm contract failed")

// ErrAccountExists error for a contract account that already exists
ErrAccountExists = sdkErrors.Register(DefaultCodespace, 2, "contract account already exists")
ErrAccountExists = sdkErrors.Register(DefaultCodespace, 3, "contract account already exists")

// ErrInstantiateFailed error for rust instantiate contract failure
ErrInstantiateFailed = sdkErrors.Register(DefaultCodespace, 3, "instantiate wasm contract failed")
ErrInstantiateFailed = sdkErrors.Register(DefaultCodespace, 4, "instantiate wasm contract failed")

// ErrExecuteFailed error for rust execution contract failure
ErrExecuteFailed = sdkErrors.Register(DefaultCodespace, 4, "execute wasm contract failed")
ErrExecuteFailed = sdkErrors.Register(DefaultCodespace, 5, "execute wasm contract failed")

// ErrGasLimit error for out of gas
ErrGasLimit = sdkErrors.Register(DefaultCodespace, 5, "insufficient gas")
ErrGasLimit = sdkErrors.Register(DefaultCodespace, 6, "insufficient gas")

// ErrInvalidGenesis error for invalid genesis file syntax
ErrInvalidGenesis = sdkErrors.Register(DefaultCodespace, 6, "invalid genesis")
ErrInvalidGenesis = sdkErrors.Register(DefaultCodespace, 7, "invalid genesis")

// ErrNotFound error for an entry not found in the store
ErrNotFound = sdkErrors.Register(DefaultCodespace, 7, "not found")
ErrNotFound = sdkErrors.Register(DefaultCodespace, 8, "not found")

// ErrQueryFailed error for rust smart query contract failure
ErrQueryFailed = sdkErrors.Register(DefaultCodespace, 8, "query wasm contract failed")
ErrQueryFailed = sdkErrors.Register(DefaultCodespace, 9, "query wasm contract failed")

// ErrInvalidMsg error when we cannot process the error returned from the contract
ErrInvalidMsg = sdkErrors.Register(DefaultCodespace, 9, "invalid CosmosMsg from the contract")
ErrInvalidMsg = sdkErrors.Register(DefaultCodespace, 10, "invalid CosmosMsg from the contract")

// ErrMigrationFailed error for rust execution contract failure
ErrMigrationFailed = sdkErrors.Register(DefaultCodespace, 10, "migrate wasm contract failed")
ErrMigrationFailed = sdkErrors.Register(DefaultCodespace, 11, "migrate wasm contract failed")

// ErrEmpty error for empty content
ErrEmpty = sdkErrors.Register(DefaultCodespace, 11, "empty")
ErrEmpty = sdkErrors.Register(DefaultCodespace, 12, "empty")

// ErrLimit error for content that exceeds a limit
ErrLimit = sdkErrors.Register(DefaultCodespace, 12, "exceeds limit")
ErrLimit = sdkErrors.Register(DefaultCodespace, 13, "exceeds limit")

// ErrInvalid error for content that is invalid in this context
ErrInvalid = sdkErrors.Register(DefaultCodespace, 13, "invalid")
ErrInvalid = sdkErrors.Register(DefaultCodespace, 14, "invalid")

// ErrDuplicate error for content that exsists
ErrDuplicate = sdkErrors.Register(DefaultCodespace, 14, "duplicate")
ErrDuplicate = sdkErrors.Register(DefaultCodespace, 15, "duplicate")
)