Conversation
Provides a function that will not panic if MAX is exceeded. This is particularly useful if MAX is changed from u64::MAX to MAX_MONEY.
Explicitly panic if MAX is exceeded. This is particularly usefull if MAX is adjusted from u64::MAX to MAX_MONEY.
Pull Request Test Coverage Report for Build 12223807707Details
💛 - Coveralls |
|
What is the benefit of panicing instead of returning an error? |
Are you asking what's the benefit of having an
|
|
I wonder though if it would be wiser to deprecate |
I was referring to this line: "Explicitly panic in function from_sats" The question stands. |
@tcharding I'll try to be more precise with what was meant by "Explicitly panic in function from_sats" to hopefully dispel any confusion. What is meant is: Explicitly panic if the value passed exceeds max. In otherwords, don't overflow and panic no matter which mode. As for your earlier question "What is the benefit of panicing instead of returning an error?". The benefit of panicking is that you would only call this function ideally when you either don't care if it panics or if you know it won't. That way, you don't need to worry about handling the error case upon return. Also, there are a number of functions in the test suit that do not expect an error to be returned, and it would be a rather large and disruptive change to add that now, not to mention for those who depend on this downstream. Lastly, there is also the |
Cool, we got to the bottom of it. IMO |
@tcharding I mean I guess
If we change this to return a result, there's going to be a lot of ugly |
|
Fuck, you are using up a lot of my time these days @yancyribbens
Incorrect. |
That's because I contribute a lot to this project, more than anyone else except yourself and @apoelstra, so I take this as a compliment. |
|
closing in favor of #3730 |
Replaces #3698
With these two changes, we can add another commit to change
MAXtoMAX_MONEYnext. Once that is done, remove#[allow(clippy::absurd_extreme_comparisons)].