foundry-rs / starknet-foundry

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

Error type for cast subcommands #1606

Open abulenok opened 7 months ago

abulenok commented 7 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 7 months ago

Can also come in handy for state files

abulenok commented 6 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 6 months ago

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