Replace panic in RollHash::set_k with an error - #86
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 90.08% 90.01% -0.07%
==========================================
Files 17 17
Lines 3974 3977 +3
==========================================
Hits 3580 3580
- Misses 394 397 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
Thanks Tommi, looks good! Could you bump the patch version? |
Contributor
Author
|
done! |
johnlees
approved these changes
Aug 20, 2026
Collaborator
|
It probably doesn't matter, but the general advice is to define your own error types for library functions to return (manually or using the zero-overhead & transparent library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, another small PR to facilitate library usage. Hope it's OK.
The current implementations of RollHash will panic for invalid input data when
set_kis called. I think it'd be better to return an error so these inputs can be skipped/fixed/inspected etc. so that the panic doesn't crash the entire program if sketchlib is used as a library.I've implemented this and propagated the errors up to sketch_files, which just unwraps them. Same for sketch_files_inverted. This does break compatibility with previous versions again, though, if the affected functions are used somewhere else.