zeitgeist icon indicating copy to clipboard operation
zeitgeist copied to clipboard

[swaps] Improve error handling in `zrml-swaps`

Open maltekliemann opened this issue 2 years ago • 0 comments

The swaps pallet currently raises some questionable errors, for example MathApproximation. These seem very uninformative.

For example, if I call pool_join with a small amount of liquidity (in comparison to what's already in the pool), then ratio ends up being zero, and I get a MathApproximation error:

https://github.com/zeitgeistpm/zeitgeist/blob/b00d69fe67430efd669e54b05de682fcdb8c440a/zrml/swaps/src/utils.rs#L105-L108

How am I supposed to know what happened?

maltekliemann avatar Jul 27 '22 09:07 maltekliemann