errors.sol

Overview

This file defines the Errors abstract contract that centralizes error code constants used across the system. It provides a standardized set of numeric error identifiers, each representing a specific error condition that can occur within various smart contracts or modules. The contract acts as a common reference point for error handling, enabling consistent error reporting and interpretation throughout the application.

The error codes are declared as uint16 constants, each mapped to a unique numeric value and a descriptive identifier. Additionally, a versionErrors string constant specifies the version of the error definitions, facilitating version tracking and compatibility checks.

Contract: Errors

Purpose

The Errors contract is designed as an abstract contract, meaning it is intended to be inherited by other contracts rather than deployed on its own. By inheriting from Errors, other contracts gain access to a comprehensive list of predefined error codes, which they can use to signal various failure conditions.

Properties

Property

Type

Description

versionErrors

string constant

Indicates the current version of the error codes ("6.2.0"). Useful for version control and compatibility.

ERR_NO_SALT to ERR_STAKE_DIDNT_EXIST

uint16 constant

Numeric error codes representing specific error scenarios.

Error Codes Description

Each error constant represents a unique error condition. For example:

These codes cover a wide range of error conditions related to permissions, state validations, data integrity, contract versioning, and domain-specific logic such as wallets, branches, tasks, and proposals.

Usage Example

Contracts inheriting from Errors can use the defined constants to revert with specific error codes, facilitating easier debugging and error handling. For example:

contract MyContract is Errors {
    function doSomething(uint value) external {
        if (value == 0) {
            revert(string(abi.encodePacked("Error ", uint(ERR_LOW_VALUE))));
        }
    }
}

This pattern allows external callers and interfaces to programmatically interpret the error codes returned from contract calls.

Implementation Details

Interaction with Other System Components

Diagram

classDiagram
class Errors {
<<abstract>>
+versionErrors: string
+ERR_NO_SALT: uint16
+ERR_SENDER_NOT_DAO: uint16
+ERR_ZERO_ROOT_KEY: uint16
+ERR_ZERO_ROOT_GOSH: uint16
+ERR_LOW_VALUE: uint16
+ERR_NOT_ROOT_REPO: uint16
+ERR_INVALID_SENDER: uint16
+ERR_LOW_BALANCE: uint16
+ERR_DOUBLE_MSG: uint16
+ERR_SENDER_NO_ALLOWED: uint16
+ERR_NO_DATA: uint16
+ERR_NOT_OWNER: uint16
+ERR_BRANCH_NOT_EXIST: uint16
+ERR_NOT_EMPTY_BRANCH: uint16
+ERR_BRANCH_EXIST: uint16
+ERR_TOO_MANY_PARENTS: uint16
+ERR_SECOND_CHANGE: uint16
+ERR_NOT_LAST_CHECK: uint16
+ERR_DONT_PASS_CHECK: uint16
+ERR_WRONG_COMMIT_ADDR: uint16
+ERR_NEED_PUBKEY: uint16
+ERR_WRONG_NAME: uint16
+NOT_ERR: uint16
+ERR_WRONG_KEY: uint16
+ERR_WALLET_NOT_EXIST: uint16
+ERR_WRONG_BRANCH: uint16
+ERR_DIFF_ALREADY_USED: uint16
+ERR_PROCCESS_IS_EXIST: uint16
+ERR_PROCCESS_END: uint16
+ERR_NO_NEED_ANSWER: uint16
+ERR_WRONG_DATA: uint16
+ERR_NOT_EMPTY_DATA: uint16
+ERR_SNAPSHOT_NOT_READY: uint16
+ERR_EMPTY_BRANCH: uint16
+ERR_GOSH_UPDATE: uint16
+ERR_OLD_CONTRACT: uint16
+ERR_SYSTEM_CONTRACT_BAD_VERSION: uint16
+ERR_BAD_COUNT_PARENTS: uint16
+ERR_REPOSITORY_NOT_READY: uint16
+ERR_PREV_NOT_EXIST: uint16
+ERR_WRONG_DAO: uint16
+ERR_TOMBSTONE: uint16
+ERR_BAD_NUMBER_CUSTODIANS: uint16
+ERR_NOTHING_TO_CONFIRM: uint16
+ERR_ALREADY_CONFIRMED: uint16
+ERR_WRONG_NUMBER_MEMBER: uint16
+ERR_BAD_PARENT: uint16
+ERR_TOO_LOW_BALANCE: uint16
+ERR_FIRST_DAO: uint16
+ERR_MESSAGE_EXPIRED: uint16
+ERR_MESSAGE_WITH_HUGE_EXPIREAT: uint16
+ERR_MESSAGE_IS_EXIST: uint16
+ERR_TOO_MANY_DIFFS: uint16
+ERR_CONTRACT_BAD_VERSION: uint16
+ERR_NOT_ALONE: uint16
+ERR_TASK_COMPLETED: uint16
+ERR_TASK_NOT_COMPLETED: uint16
+ERR_ASSIGN_NOT_EXIST: uint16
+ERR_REVIEW_NOT_EXIST: uint16
+ERR_MANAGER_NOT_EXIST: uint16
+ERR_NEED_SMV: uint16
+ERR_BRANCH_PROTECTED: uint16
+ERR_WALLET_LIMITED: uint16
+ERR_LOW_TOKEN_RESERVE: uint16
+ERR_LOW_TOKEN: uint16
+ERR_TOO_MANY_TAGS: uint16
+ERR_NOT_READY: uint16
+ERR_NOT_ALLOW_MINT: uint16
+ERR_DIFFERENT_COUNT: uint16
+ERR_TOO_MANY_VESTING_TIME: uint16
+ERR_ZERO_GRANT: uint16
+ERR_WRONG_LOCK: uint16
+ERR_TOO_MANY_PROPOSALS: uint16
+ERR_TOO_FEW_PROPOSALS: uint16
+ERR_WRONG_UPGRADE_STATUS: uint16
+ERR_WALLET_EXIST: uint16
+ERR_PROGRAM_EXIST: uint16
+ERR_PROGRAM_NOT_EXIST: uint16
+ERR_WRONG_BLS_PUBKEY: uint16
+ERR_STAKE_DIDNT_EXIST: uint16
}