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

PLAT-11641 handle json serialisation errors and remove payloads #773

Merged
merged 11 commits into from
Feb 29, 2024

Conversation

richardelms
Copy link
Contributor

@richardelms richardelms commented Feb 26, 2024

Goal

Error handling

Sometimes, while flushing the session and event cache, a serialisation error can occur.

This PR improves the handling of those errors. The new setup is as follows:

  • if an error occurs while trying to serialise the json into a dictionary then we silently remove the offending file, as it is most likely caused by an unpreventable IO error.
  • if an error occurs while trying to create an event or session from the dictionary then we remove the file. At a later date we will implement reporting this issue internally.

File writing

It could be possible the the method File.writeAllText is buffered under the hood. So we are now using a file stream to write data and using the method FileStream.Flush to force it to write all at once.

Testing

Covered by existing tests

@richardelms richardelms changed the title handle errors and remove payloads PLAT-11641 handle errors and remove payloads Feb 26, 2024
@richardelms richardelms changed the title PLAT-11641 handle errors and remove payloads PLAT-11641 handle json serialisation errors and remove payloads Feb 26, 2024
@richardelms richardelms self-assigned this Feb 26, 2024
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Feb 26, 2024

Build size impact

Format Size impact of Bugsnag (kB)
IL2CPP APK 2348.56
IL2CPP IPA 1348.39

Generated by 🚫 Danger

@richardelms richardelms marked this pull request as ready for review February 27, 2024 10:18
src/BugsnagUnity/Delivery.cs Outdated Show resolved Hide resolved
src/BugsnagUnity/Delivery.cs Outdated Show resolved Hide resolved
src/BugsnagUnity/Delivery.cs Outdated Show resolved Hide resolved
@richardelms richardelms merged commit 8165e64 into next Feb 29, 2024
11 checks passed
@richardelms richardelms deleted the 11641-cacheFlushErrorHandling branch February 29, 2024 21:20
@richardelms richardelms mentioned this pull request Feb 29, 2024
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