Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backwards compatibility with latest release? #123

Closed
coladarci opened this issue Feb 18, 2021 · 3 comments
Closed

Backwards compatibility with latest release? #123

coladarci opened this issue Feb 18, 2021 · 3 comments

Comments

@coladarci
Copy link

This is totally on us with a bad decision, but out of curiosity, how hard would it be to make the latest change backwards compatible for Money objects stored in ETF Pre release?

KeyError: key :format_options not found in: #Money<:USD, 4497.81>
  File "lib/money.ex", line 707, in Money.to_string/2
  File "lib/money.ex", line 766, in Money.to_string!/2

🤦‍♂️

@kipcole9
Copy link
Owner

Ahhh, so this is coming from :erlang.binary_to_term/1? Its a good point and its on me (too) since backwards compatibility is important. Let me do some experiments today and see if I can make that work.

@coladarci
Copy link
Author

I’m not sure it’s fair to say it’s on you - your library IS backwards compatible, it just makes the assumption that money structs are created with that version of the library (which feels very fair); we are doing some oddness on our end.

That said, if it’s an easy win it’d help us out or a jam, of sorts!

@kipcole9
Copy link
Owner

Thanks as always for the collaboration. It was an easy fix. Published ex_money version 5.5.1 with the following changelog entry:

Bug Fixes

  • Fix formatting a t:Money that has no :format_options key. That can happen if re-hydrating a t:Money using :erlang.binary_to_term/1 from an older version of ex_money that doesn't have the :format_options key in the struct. Thanks to @coladarci. Fixes Backwards compatibility with latest release? #123.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants