You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some areas where panic is warranted however there are others (e.g. rescale, from_bytes_le) that we could utilize Rust's error handling further. In addition, with libraries such as error-chain we can perhaps make the error handling experience richer with little overhead.
The text was updated successfully, but these errors were encountered:
I would propose that panics be only for truly unrecoverable errors, which in this case should be limited to debug mode perhaps? In general I think there should be no panics for the Mul/Add/Div/Sub/etc traits, and instead there be a checked_mul/div/add/sub/etc function for each implemented under the Decimal trait that returns an error type (through error-chain). Perhaps having panic on release and/or debug can be a feature flag?
Have expanded checked operators into #80. I do like the idea of debug mode only panic's however would like to perhaps come up with a clear set of rules. For div, for example, I'm thinking:
Div by zero = panic. If not panic, what would make sense to return? We could introduce the concept of Infinity within flags?
There are some areas where
panic
is warranted however there are others (e.g.rescale
,from_bytes_le
) that we could utilize Rust's error handling further. In addition, with libraries such aserror-chain
we can perhaps make the error handling experience richer with little overhead.The text was updated successfully, but these errors were encountered: