Description
Component the issue is related to
Cast
Issue
Errors in Cast are propagated in a few inconsistent ways:
-
unwrap
orexpect
- not only for strictly critical errors like runtime instantiation, but also for things like failed compilation (see here) -
A nice error descriptions generated by
print_command_result
, e.g.
command: invoke
error: An error occurred in the called contract[..]Requested contract address 0x1 is not deployed[..]
Those appear only for errors thrown by main command handlers (e.g. starknet_commands::declare::declare) and no other errors possible to occur during command execution.
anyhow::Error
returned bymain::run_async_command
- errors from helper functions likeget_block_id
(here) called before the main command handler are just propagated upwards and get printed in the console with no command info present in 2.
We could introduce consistent error handling accross all cast functionalities by substituting expect
s with bail
s and moving print_command_result
calls outside the giant match
in run_async_command
so all the errors are presented to user in the same style.
Perhaps some extension/rework of print_command_result
is necessary.
Metadata
Metadata
Assignees
Type
Projects
Status