Skip to content

Document the new exception hierarchy #2779

@fselmo

Description

@fselmo

In v6, we are introducing Web3Exception and inheriting eth_utils.exceptions.ValidationError across Web3ValidationError, EthPMValidationError and ENSValidationError. We should document this hierarchy and give examples of why this is useful / how to fine tune exception handling moving forward.

i.e.

try:
    ...

# catch only validation errors within web3
except Web3ValidationError:
    ...

# catch all web3 errors, including web3 validation errors
except Web3Exception:
    ...

# catch all validation errors across the web3 library stack (still needs to be reflected in `eth-tester`, `eth-abi`, `eth-account`, etc)
except ValidationError:
    ...

Changes related to standardizing the ValidationError will have to be coordinated for other libraries in the web3 stack:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions