Skip to content

Improve error handling abstractions in wasm-transform and wasm-chain-integration #203

@abizjak

Description

@abizjak

Task description

The interpreter and wasm-chain integration often use anyhow::Error as an error type. This is for historical reasons since during initial development this is most flexible. We then use downcast to identify whether specific errors, such as OutOfEnergy occurred. We also have a number of other concrete errors that I needed during testing. Still there are some remaining errors that are just bail!("arbitrary string").

The ideal way of doing error handling is that each of the library methods (i.e., all of parsing, validation, interpreter) would return a precise error, which would be an enum. anyhow::Error should only be used in cargo-concordium at the application level.

This task is to get to this point.

Sub-tasks

  • replace anyhow::Error in wasm-transform functions with precise errors. Using thiserror crate to handle the boilerplate
  • replace anyhow::Error in wasm-chain-integration functions with precise errors. Using thiserror crate to handle the boilerplate
  • propagate changes

This will make error handling more robust. In particular with the current setup checking whether execution failed with out of energy, or whether it failed for some other reason is not clean and transparent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Prio] LowShould be fixed if time permits but can be postponed.[Type] TaskAn additional feature or improvement.good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions