Skip to content

Better error messages for nested structs - #224

Open
virtuald wants to merge 3 commits into
konradhalas:masterfrom
virtuald:better-error-messages
Open

virtuald wants to merge 3 commits into
konradhalas:masterfrom
virtuald:better-error-messages

Conversation

@virtuald

@virtuald virtuald commented Mar 7, 2023

Copy link
Copy Markdown
  • dicts now have the key name in them
  • lists/tuples now have the index in them

Old error message:

dacite.exceptions.WrongTypeError: wrong value type for field "t.t2.name" - should be "str" instead of value "1" of type "int"

New error message:

dacite.exceptions.WrongTypeError: wrong value type for field "t[name].t2[0].name" - should be "str" instead of value "1" of type "int"

virtuald added 3 commits March 6, 2023 20:38
- dicts now have the key name in them
- lists/tuples now have the index in them
- Previously just raised original exception, now includes the field name
@AlejandroUPC

Copy link
Copy Markdown

Been working in something similar, IMO this changes makes only sense if they are applied to all other types of exceptions (MissingValue, UnionMatch) but this can be done gradually if maintainers agree

This branch has not been deployed

No deployments
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