Skip to content

Conversation

@v0idpwn
Copy link

@v0idpwn v0idpwn commented Jul 9, 2024

Per elixir-ecto/ecto#4445

I don't see a reason to prefer to_string over inspect here, maybe I'm missing something :)

@viniciussbs
Copy link

So, I've tried inspect/1 in a custom errors_on/1 implementation in my code base. I gave up because decimal values get weird representation when interpolated using inspect/1:

iex(1)> to_string(Decimal.new(0))
"0"
iex(2)> inspect(Decimal.new(0))
"Decimal.new(\"0\")"

@v0idpwn
Copy link
Author

v0idpwn commented Jul 9, 2024

Considering this function is built for testing, one could would argue that Decimal.new("0") is a more precise depiction of the data for the error message than 0.

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

Successfully merging this pull request may close these issues.

2 participants