nearcore
nearcore copied to clipboard
We should unwrap or expect on borsh `try_to_vec`
Most of the code (all) that uses try_to_vec
will never have an error from Borsh. Right now it's confusing which error a function can throw and some of them don't even need to return an Error
at all.
If we replace try_to_vec()?
with try_to_vec().expect("borsh")
then the code going to be easier to handle. E.g.
@mikhailOK
This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
should we just implement something in borsh that unwraps the error?
This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Hi may I check if swapping propagation of error to expect statements still a good approach for this Issue?
Hi may I check if swapping propagation of error to expect statements still a good approach for this Issue?
I think so. cc @matklad
@AnhTuDo1998 yes, we should generally add .expect
to every try_to_vec. The devil is in details though -- we need to carefully check under which conditions this can actually panic (NaNs and collections longer than u32::MAX
elements I think) and double-check that we can't hit such cases.