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

Allow the usage of JSON for Elixir 1.18+ #845

Merged
merged 7 commits into from
Jan 7, 2025
Merged

Conversation

whatyouhide
Copy link
Collaborator

@altjohndev I couldn't force push to your branch, but this is your PR with some changes I made on top of it to remove the compile-time configuration and other small cleanups. Can you review this? 🙃

@altjohndev
Copy link

LGTM, thanks for applying the changes!

The CI is failing for Elixir 1.18+. Maybe test/support/*can be ignored for Dialyzer?

assert error.__struct__ == JSON.DecodeError
else
assert error.__struct__ == Jason.DecodeError
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we're introducing a shim under Sentry.JSON shouldn't we also raise Sentry.JSON.DecodeError?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not introducing Sentry.JSON for users, it's just for us during this transition time.

Co-authored-by: Peter Solnica <[email protected]>
@whatyouhide whatyouhide merged commit f375551 into master Jan 7, 2025
4 checks passed
@whatyouhide whatyouhide deleted the pr/altjohndev/844 branch January 7, 2025 10:29
@ruslandoga
Copy link
Contributor

ruslandoga commented Mar 2, 2025

👋

Just FYI:

iex(2)> Sentry.JSON.encode(%{"dates" => %{Date.utc_today => 1}}, JSON)
{:error,
 %FunctionClauseError{
   module: :elixir_json,
   function: :key,
   arity: 2,
   kind: nil,
   args: nil,
   clauses: nil
 }}
 
iex(3)> Sentry.JSON.encode(%{"dates" => %{Date.utc_today => 1}}, Jason)
{:ok, "{\"dates\":{\"2025-03-02\":1}}"}

Related: elixir-lang/elixir#14305

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.

None yet

4 participants