You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MissingFieldException currently provides the names of the missingFields, but it does not provide the name of the class/type the fields were missing from, despite being a constructor parameter.
Currently, the serialName of the affected type is provided to the constructor, and used to construct the error message. This should be made available as a field on the MissingFieldException, to enable programmatic determination of the source of the error.
This is particularly useful when deserializing into a class hierarchy, as the name of the missing field alone may be ambiguous, and exception handlers may need to know the type of the affected class to determine the best course of action.
Adding the serialName as a field should be a trivial addition, since it's already available in the constructor.
It might also be useful to go further, and provide a "path" to the missing fields in the JSON AST, which would provide exception handlers with even more information, which could be especially useful in error messages.
The text was updated successfully, but these errors were encountered:
nicktelford
changed the title
MissingFieldException should return serialName
MissingFieldException should return serialName of affected class
Mar 20, 2025
nicktelford
changed the title
MissingFieldException should return serialName of affected class
MissingFieldException should return class serialName
Mar 20, 2025
MissingFieldException
currently provides the names of themissingFields
, but it does not provide the name of the class/type the fields were missing from, despite being a constructor parameter.Currently, the
serialName
of the affected type is provided to the constructor, and used to construct the error message. This should be made available as a field on theMissingFieldException
, to enable programmatic determination of the source of the error.This is particularly useful when deserializing into a class hierarchy, as the name of the missing field alone may be ambiguous, and exception handlers may need to know the type of the affected class to determine the best course of action.
Adding the
serialName
as a field should be a trivial addition, since it's already available in the constructor.It might also be useful to go further, and provide a "path" to the missing fields in the JSON AST, which would provide exception handlers with even more information, which could be especially useful in error messages.
The text was updated successfully, but these errors were encountered: