[Zope] How can I improve error messages?
Gustin Kiffney
Gustin Kiffney" <Gustin_Kiffney@fd.org
Tue, 11 Jan 2000 13:14:35 -0500
OK, I've been hammered for the past couple of days because I was witless enough
to use
'client' and 'id' as field names in SQL methods. I should have known better, I
suppose, but that's the point of being a newbie - you DON'T know better, and
really, you can't. Here's the super-uninformative error message I was getting:
Error: TypeError: keyword parameter redefined
SQL:
Could not render the query template!
And the HTML source indicated only that the problem was with my sql method -
which I knew, because I'd been testing it over and over again, making unhelpful
changes, hoping the magic cave would open and this ridiculous query would run.
I grepped through the ZOPE source and apparently the phrase 'keyword parameter
redefined' is emitted by Python, not Zope. Looking now through the Zope Quick
Reference Guide there appear to be many names I can't use, which is OK, but a
more robust system would tell me more about what went wrong. I guess this is a
rap against Python more than Zope, but could these error messages possibly be
extended to say something like
ERROR: TypeError: 'client' keyword parameter redefined
Or maybe could Zope trap this kind of error rather than letting Python handle
it, which really doesn't generate extremely lucid error messages as a rule
anyway? That would have saved the drywall in my office which has many
head-shaped dents in it right now.