#29516: Improve error message when passing incorrect kwarg to model constructor
-------------------------------------------+-------------------------------
               Reporter:  Federico Bond    |          Owner:  (none)
                   Type:  Uncategorized    |         Status:  new
              Component:  Error reporting  |        Version:  master
               Severity:  Normal           |       Keywords:  error message
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+-------------------------------
 When passing an incorrect keyword argument to a model constructor, the
 __init__ method will throw an error like this:

 {{{
 TypeError: 'x' is an invalid keyword argument for this function
 }}}

 It takes a couple of seconds to notice what "this function" refers to,
 especially if the call is behind some abstraction like factory_boy. You
 have to scroll several levels up the stack trace to notice the offender. I
 propose to change this message to:

 {{{
 TypeError: 'x' is an invalid keyword argument for ModelName
 }}}

 I can submit a pull request once the ticket is accepted.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29516>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/055.7de7ff856faceaa6e253a6d91d1044f6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to