Open paupino opened 7 years ago
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:
Infinity
within flags? Thoughts?
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.