Skip to content
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

Better exception message for non supported fields #230

Closed
berinhard opened this issue Aug 13, 2021 · 0 comments · Fixed by #301
Closed

Better exception message for non supported fields #230

berinhard opened this issue Aug 13, 2021 · 0 comments · Fixed by #301
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@berinhard
Copy link
Member

berinhard commented Aug 13, 2021

Expected behavior

To add the field name to the exception that's raised when bakery can't handle a specific field type. Not having the field name in the exception forces the developer to inspect the model definition to figure out what's the name of the field they may want to add default values.

The ideal exception message could be something like:

TypeError: field field_name type <class 'markupfield.fields.MarkupField'> is not supported by baker.

Actual behavior

TypeError: <class 'markupfield.fields.MarkupField'> is not supported by baker.

Reproduction Steps

Install a thirdy party app which implements custom fields, define a model with an unsupported field type and try to call baker.make for that model.

Versions

Python: 3.9
Django: 3.2
Model Bakery: 1.3.2

@berinhard berinhard added enhancement New feature or request good first issue Good for newcomers labels Aug 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant