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

Wrong match on json decode error #916

Open
shinnokdisengir opened this issue Mar 25, 2024 · 0 comments · May be fixed by #948
Open

Wrong match on json decode error #916

shinnokdisengir opened this issue Mar 25, 2024 · 0 comments · May be fixed by #948
Labels
app:realm_management This issue or pull request is about astarte_realm_management application internals This issue or pull request is about implementation details

Comments

@shinnokdisengir
Copy link
Contributor

Description

The library jason was adopted after poison but the errors were not updated

Expected Behavior

{:error,
   %Jason.DecodeError{}
}

Current Behavior

{:error, {:invalid, _invalid_str, _invalid_pos}} ->
        _ =
          Logger.warning("Received invalid interface JSON: #{inspect(interface_json)}.",
            tag: "invalid_json"
          )

        {:error, :invalid_interface_document}

      {:error, %Ecto.Changeset{} = changeset} ->
        _ =
          Logger.warning("Received invalid interface: #{inspect(changeset)}.",
            tag: "invalid_interface_document"
          )

        {:error, :invalid_interface_document}

see here:

{:error, {:invalid, _invalid_str, _invalid_pos}} ->

{:error, {:invalid, _invalid_str, _invalid_pos}} ->

Additional Information

The fix of the issue could be also just removing the error handling since the json is already validated by api so it shouldn't fail

@shinnokdisengir shinnokdisengir added the app:realm_management This issue or pull request is about astarte_realm_management application label Mar 25, 2024
@Annopaolo Annopaolo added the internals This issue or pull request is about implementation details label May 20, 2024
@eddbbt eddbbt linked a pull request May 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:realm_management This issue or pull request is about astarte_realm_management application internals This issue or pull request is about implementation details
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants