From d4e39aa30e1eb741bd4bb682fd9f3d25e856d5ba Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Tue, 6 Oct 2020 17:20:09 +0200 Subject: [PATCH] Increment x/wasm error codes by 1 --- x/wasm/internal/types/errors.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/x/wasm/internal/types/errors.go b/x/wasm/internal/types/errors.go index ad70bdabdb..a07dedaa10 100644 --- a/x/wasm/internal/types/errors.go +++ b/x/wasm/internal/types/errors.go @@ -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") )