[ENCHANCEMENT] HoloHash::from_raw_39
- handle bad length as error instead of panicking
#3313
Labels
HoloHash::from_raw_39
- handle bad length as error instead of panicking
#3313
Issue
Calling e.g.
AgentPubKey::from_raw_39(bytes)
on something that isn't 39 bytes long causes an assertion failure. This seems surprising seeing as the function returns aHoloHashResult
, which includes the variantErr(HoloHashError::BadSize)
. This forces the developer to check the length proactively in addition to handling the result.Expected behaviour
The function returns an
Err
instead of panicking.The text was updated successfully, but these errors were encountered: