JsonTypeInfo OnDeserialized context for better error propagation #83155
Unanswered
tyler-boyd
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
I have code that uses OnDeserialized to perform some validations, picture something like this:
The problem I have is that the JsonException I throw does not contain any information about where in the JSON the object that threw the exception is. When errors happen during JSON parsing, there is a
path
field like$.array[150].example
, but in theOnDeserialized
callback there is no way to find out where in the object graph we are.Is what I'm doing bad? Am I missing a way to give more meaningful error messages? Or is this something that would have to be added to STJ?
Beta Was this translation helpful? Give feedback.
All reactions