-
-
Notifications
You must be signed in to change notification settings - Fork 488
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
Handle TargetInvocationException when reading a property #879
base: master
Are you sure you want to change the base?
Handle TargetInvocationException when reading a property #879
Conversation
f367d8d
to
8d9297e
Compare
I'm sorry for this mess of closing and reopening. I'm getting used to contributing to OSS 😅 |
8d9297e
to
4d3571f
Compare
Can also add this to the static serializer pieces of yamldotnet? |
I've added test StaticSerializationHandlesTargetInvocationException but I don't understand the static serializer output. The serializer doesn't throw and returns empty object output |
cf8ed3b
to
efc6b10
Compare
Just looked this over. One other comment, it may be better to bring the exception handling logic out of the object descriptor, instead pass in a method that would get called in the catch. Takes 3 parameters, exception, object and property. Default of that method would be throw. Then people can handle any different exceptions differently based on their needs. For example, dump out the exception message. |
efc6b10
to
a92bdb0
Compare
…andler that converts the exception to an error message string
a92bdb0
to
e6826e9
Compare
@EdwardCooke Hi Edward, I've implemented the support of custom exception handler function. But I haven't implemented default method "throw". I don't like this idea because try/catch block may affect performance in simple cases like serialization of plain objects with only auto-properties (POCO). |
In my project I use YamlDotNet to serialize arbitrary objects. I can't mark properties of the objects with [YamlIgnore] but I want serializer not to fail in cases when an erroneous property is met. Could you add an ability to serialize such properties as YAML strings literals with a simple error message?