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

Output more friendly exception messages in case of serialization failure, like what property failed to serialize according to the schema #108

Open
sergiutugulschi opened this issue Nov 27, 2020 · 1 comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@sergiutugulschi
Copy link

sergiutugulschi commented Nov 27, 2020

When I try to serialize an object that has a not null string property in avro schema but I set is as null in code I'm getting System.ArgumentNullException: String reference not set to an instance of a String. (Parameter 's')
at System.Text.Encoding.GetBytes(String s)
at Transaction serializer(Closure , TransactionAvro )
at Chr.Avro.Serialization.BinarySerializer`1.Serialize(T value)

Not clear at what property it failed, it will be better to have an exception like Serialization failed, expected property {nameOfTheProperty} to be not null but was null. Or exepected property type to be string but was int, etc.

@sergiutugulschi sergiutugulschi changed the title Output what property failed to serialize according to the schema Output more friendly exception messages in case of serialization failure, like what property failed to serialize according to the schema Nov 27, 2020
@dstelljes dstelljes added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 28, 2020
@dstelljes dstelljes added this to the 8.0.0 milestone Nov 28, 2020
@dstelljes dstelljes removed this from the 8.0.0 milestone Feb 14, 2022
@dstelljes
Copy link
Member

This situation is somewhat improved at serde build time with 39fa633, but improving runtime exceptions like the one shown above will need some additional investigation to implement without impacting performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants