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

Catch error during serialization #576

Merged
merged 1 commit into from
Oct 31, 2022

Conversation

stephpy
Copy link
Contributor

@stephpy stephpy commented Aug 3, 2022

Description of the change

In some case ... payload has some data which are corrupted. When payload is serialized an error occured. I guess the first goal of rollbar is there to log data to rollbar, even if some data of payload cannot be serialized.

My case:

Context:

I have 2 entities (doctrines)

User -> Medias
Medias has a property with an enum status: [inprogress, done]

Call:

Get user #1 with n Medias. One of theses medias has a bad enum status (foo for example).
I get a ValueError saying my enum is invalid since it does not respect the cases.

Easy for rollbar .... but in the payload of my data sent to rollbar, I have the Doctrine PersistentCollection (related to call user->medias). And when this iterator is serialized, it retry to create my object with a bad enum. Doctrine never created this object and rollbar cannot detect this error.

With this PR, i'll only got a message saying data cannot be serialized
Without I get a 500 and no logs to rollbar.

Type of change

  • Bug fix (non-breaking change that fixes an issue)

@stephpy
Copy link
Contributor Author

stephpy commented Sep 2, 2022

Any thoughts ?

@danielmorell danielmorell self-assigned this Oct 31, 2022
@danielmorell danielmorell self-requested a review October 31, 2022 21:17
Copy link
Collaborator

@danielmorell danielmorell left a comment

Choose a reason for hiding this comment

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

This makes a lot of sense to me! Thank you!

@danielmorell danielmorell merged commit 169cee9 into rollbar:master Oct 31, 2022
@stephpy
Copy link
Contributor Author

stephpy commented Nov 15, 2022

Thank you :) Could you create a release with all theses changes ? :) Thanks

@stephpy stephpy deleted the stephpy-patch-1 branch November 15, 2022 09:02
@danielmorell
Copy link
Collaborator

danielmorell commented Nov 18, 2022

Oops @stephpy sorry I missed your comment. I had a few things I was hoping to include in the next release preparing for v4.0 and make this part of v3.2 with them. But the changes for v3.2 are still a little way off. I will try to publish this as v3.1.4 tomorrow.

@stephpy
Copy link
Contributor Author

stephpy commented Nov 18, 2022

Thank you @danielmorell 🍻

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

2 participants