GNOME Bugzilla – Bug 620804
Make the "wrong argument count" exception more explicit.
Last modified: 2010-06-10 07:33:49 UTC
This patch makes it easier to debug when there is an error due to a wrong argument count in a pygi function call, by adding the function name to the exception message. You now get:
+ Trace 222281
buffer.create_mark("input-line", buffer.get_end_iter(), True)
return info.invoke(*args) TypeError: get_end_iter() takes exactly 2 argument(s) (1 given)
Created attachment 162905 [details] [review] Make the "wrong argument count" exception more explicit. Previously we had messages like this one: TypeError: takes exactly 2 argument(s) (1 given) With this patch, they become like this: TypeError: get_end_iter() takes exactly 2 argument(s) (1 given) It makes things much easier to debug when there are several pygi calls on the same line.
Comment on attachment 162905 [details] [review] Make the "wrong argument count" exception more explicit. Looks good. Please add a test before committing. Simply take one of the functions from Everything and check that the error messages starts with the name of the function (there might even be a test that checks for wrong number of parameters that you could modify)
Created attachment 163173 [details] [review] Make the "wrong argument count" exception more explicit. The same with a test against Everything.
Comment on attachment 163173 [details] [review] Make the "wrong argument count" exception more explicit. there was no need to post another patch once I approved the first one. I just wanted to make sure you added a test before committing. Commit away.
and close this bug once you commit
Sure, I know you set it as accepted-commit-now, but I wanted to make sure I did the test the right way at the right place. I've now committed the patch into master. Attachment 163173 [details] pushed as 07df124 - Make the "wrong argument count" exception more explicit.