Skip to content

Added in a more user-friendly error message for when a field is missi… - #503

Open
genixpro wants to merge 1 commit into
lidatong:masterfrom
genixpro:master
Open

Added in a more user-friendly error message for when a field is missi…#503
genixpro wants to merge 1 commit into
lidatong:masterfrom
genixpro:master

Conversation

@genixpro

@genixpro genixpro commented Nov 26, 2023

Copy link
Copy Markdown

Previously this code was just crashing if I attempted to decode JSON with a field missing. Now it will crash with an error message that indicates more precisely what is actually happening.

…ng, rather than just allowing the default exception which is hard to interpret.
@george-zubrienko

Copy link
Copy Markdown
Collaborator

@genixpro looks like this breaks the test suite:

raise TypeError(
f"The JSON data is missing the required field '{field.name}' when decoding {cls.name} from JSON."
)

Maybe you can have a look why?

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.

2 participants