Skip to content

Allow the usage of JSON for Elixir 1.18+ - #845

Merged
whatyouhide merged 7 commits into
masterfrom
pr/altjohndev/844
Jan 7, 2025
Merged

whatyouhide merged 7 commits into
masterfrom
pr/altjohndev/844

Conversation

@whatyouhide

Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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.

Comment thread README.md Resolved
Co-authored-by: Peter Solnica <peter@solnica.online>
@whatyouhide
whatyouhide merged commit f375551 into master Jan 7, 2025
@whatyouhide
whatyouhide deleted the pr/altjohndev/844 branch January 7, 2025 10:29
@ruslandoga

ruslandoga commented Mar 2, 2025 •

Copy link
Copy Markdown
Contributor

👋

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.

4 participants