Currently LengthError doesn't return the expected vs actual lengths.
Changing this would be a semver breaking change, but downstream it is useful to have this information for logging purposes, the current work around is to store the length first which feels unnecessary and isn't as clean.
Alternatively, functions like GenericArray::try_from_vec could return the Vec itself on error (I think this is a better approach and follows std conventions) which would allow consumers to either use them in a different way or to create their own error at that point.
Currently LengthError doesn't return the expected vs actual lengths.
Changing this would be a semver breaking change, but downstream it is useful to have this information for logging purposes, the current work around is to store the length first which feels unnecessary and isn't as clean.
Alternatively, functions like GenericArray::try_from_vec could return the Vec itself on error (I think this is a better approach and follows std conventions) which would allow consumers to either use them in a different way or to create their own error at that point.