timescaledb-toolkit
timescaledb-toolkit copied to clipboard
replace unwrap() with expect("unique message")
unwrap() gives no clues where to look when a bug arises. This change replaces common tdigest unwrap() calls with expect("message").
This does the same thing as unwrap(), it just provides more context for users to report with bugs.
Fwiw, I find that explaining an expectation in rust can sometimes show me that the expectation is unreasonable. I can't come up with good explanations for some of these, but I gave an effort to at least provide a first-approximation of what the expectation at work is. Any refinements to what these expectations are actually trying to assert would be welcome!
It would be nice to be able to provide more information for https://github.com/timescale/timescaledb-toolkit/issues/680
I've only got a couple years of experience with Rust, but I'd strongly recommend taking a "no unwrap() outside of tests" policy!