Friday, March 05, 2004

Once more, the importance of error reporting

A major feature of Tapestry that has been ported into HiveMind is line precise error reporting. When errors occur, Tapestry and HiveMind will isolate the problem down to a particular line or a particular file ... not just when parsing an HTML template or a specification file (or a HiveMind module descriptor), but later, at runtime. Line precise error reporting is a major part of an overall attitude, a discipline, about reporting errors. It takes great effort to consistently catch and report errors, and to maintain that location information. Its very important however, because without it, your user's frustration levels will go through the roof.

I know I'm going to alienate a couple of people here so I apologize in advance. I may be a whiz in my own world, but at the moment, I'm a trembling newbie in the Hibernate world. So I'm putting together a couple of simple mapping files, and making use of the Ant schemaexport task. Now, I've done something wrong, and at this time, I don't yet know what. But see what I have to go on:

bash-2.05b$ ant export
Buildfile: build.xml

compile:
     [copy] Copying 1 file to C:\workspace\ProjectRegistry\target\classes

export:

BUILD FAILED
file:c:/workspace/ProjectRegistry/build.xml:44: Schema text failed: net.sf.hibernate.MappingException: invalid mapping

Total time: 1 second

See what I mean? Not enough effort has been expended on a) describing the actual problem (which mapping? what's actually wrong with it? how do I fix it?) and b) telling me what file is broken (never mind the line!).

This is one important aspect of HiveMind: when using HiveMind's XML support, you get much checking and much reporting for free. A hypothetical HiveMind message for this might be:

Unable to process attribute cascade (of element class/set, at file://..../Project.xbm.xml, line 27, column 35): 'deleted' is not a recognized enumerated value.

Again, I don't want this to be considered a dig at Hibernate. The core competency of Hibernate and its crew is to marshall data between Java objects and databases, something they have years and years of experience at. The core competency of HiveMind is to organize services and parse XML into objects and report errors while doing it. It might be nice for Hibernate (as well as virtually every other framework, open-source or closed) to prioritize a little bit of effort into these issues. I also look forward to a day when more frameworks leverage HiveMind for these purposes, offloading this XML parsing and error reporting burden onto it.

No comments:

Post a Comment

Please note that this is not a support forum for Tapestry. Requests for help will be deleted. Please subscribe to the Tapestry user mailing list if you are in need of support, or contact me directly for professional (for pay) support.

Spammers: Don't bother. I delete your comments and it's a waste of time for both of us. 垃圾邮件发送者:不要打扰。我删除您的评论和它的时间对我们双方的浪费