foundry-rs / starknet-foundry

Blazing fast toolkit for developing Starknet contracts.
https://foundry-rs.github.io/starknet-foundry/
MIT License
328 stars 177 forks source link

Error type for cast subcommands #1606

Open abulenok opened 10 months ago

abulenok commented 10 months ago

Which components does the task require to be changed? (think hard pls)

sncast

Description

... and incorporate transaction hash in the error struct

https://github.com/foundry-rs/starknet-foundry/pull/1358/files#r1440261704

THenry14 commented 10 months ago

Can also come in handy for state files

abulenok commented 9 months ago

https://github.com/foundry-rs/starknet-foundry/pull/1710/files#r1490733410

In https://github.com/foundry-rs/starknet-foundry/pull/1710 StarknetCommandError was introduced. Some subcommands use .map_err(handle_starknet_command_error) which converts StarknetCommandError to anyhow::Error.

One way to improve this would be to make all subcommands return StarknetCommandError, the other one is to replace handle_starknet_command_error with impl From<StarknetCommandError> for anyhow::Error and make print_command_result accept Result<T, E> where E can be converted to anyhow::Error.

abulenok commented 9 months ago

we should also include transaction hash somewhere in the StarknetCommandError (maybe as a part of TransactionError)