kipcole9 / money

Elixir implementation of Money with Currency

Home Page:https://hex.pm/packages/ex_money

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Money.from_integer spec doesn't agree with output

jdewar opened this issue · comments

spec for from_integer error is a 3-tuple, but the output in the case of an error is a 2-tuple with a 2-tuple in the second slot.

spec says: from_integer(integer(), currency_code(), Keyword.t()) :: t() | {:error, module(), String.t()}

iex says:

iex(2)> Money.from_integer(1000, :UD) 
{:error, {Cldr.UnknownCurrencyError, "The currency :UD is invalid"}}

Thanks for the report. I have published ex_money version 5.7.2 with the following changelog entry:

Bug Fixes

  • Fix spec for Money.from_integer/3. Thanks to @jdewar for the report.

Enhancements

  • Support a :fractional_digits option for Money.from_integer/3 and improve the documentation.