This violates the typespec for Ecto.Type.cast: cast(term()) :: {:ok, term()} | {:error, keyword()} | :error, and causes an exception when used in Ecto.Changeset.cast
Please see this demo repo for a demonstration of the issue.
Incidentally, it appears that the load functions also violate the error typespec from Ecto.Type.
When casting an invalid currency, the both ecto types return an error tuple with another tuple as the second element.
https://github.com/kipcole9/money_sql/blob/bbc4f69b0152cb052c945fa17c51417103dc0b4b/test/money_ecto_test.exs#L72
This violates the typespec for
Ecto.Type.cast
:cast(term()) :: {:ok, term()} | {:error, keyword()} | :error
, and causes an exception when used inEcto.Changeset.cast
Please see this demo repo for a demonstration of the issue.
Incidentally, it appears that the
load
functions also violate the error typespec from Ecto.Type.