On Nov 18, 2008, at 11:43 AM, Ramsey Lee Gurley wrote:

Okay, so I've tried this twice now, and both bounced immediately. I hope three of these don't show up on the list, but I think the problem must have been how my mobileme System preference automatically set up my email account's reply address. Trying one more time...

On Nov 17, 2008, at 4:20 PM, Mike Schrag wrote:

That's the guy behind the famous "Don’t swallow", right?
This is slightly different, though ... I think everyone's onboard with not swallowing exceptions.


Umm, I'm a little vague on that point personally... I was recently asked not to swallow exceptions when submitting a patch, but frankly... I've heard of it, but I'm not sure what that means. I read the wiki-page on exception handling...

http://wiki.objectstyle.org/confluence/display/WO/Handling+Errors+and+Exceptions**

So... I'm still a little confused :)

try {
        ....
}
catch (Exception e) {}

That is swallowing. Don't do it. It just hides errors. OK, there are some rare, er, exceptions to this rule where the exception is expected and useless.


I'm talking about chaining exceptions appropriately. But the problem is that if you only throw RuntimeExceptions, the people below you have no idea what you might throw and therefore have no idea when they need to catch and rethrow, which makes it kind of weird trying to do this effectively with only Runtimes. So my comment about Chuck was that he doesn't agree with CHECKED exceptions.


Reading this thread, am I to understand that "don't swallow" means "always throw" and logging is always unacceptable?

Generally yes. If the exception is expected and can be dealt with or ignored with the process succeeding as normal, then logging is OK. But "this will never throw, so never mind, just bury it" is never, ever acceptable.


If so, what is convention? Do I throw a wrapped exception in a NSForwardException or something similar?

This seems to be the Wonder standard:

            try {
                ...
            } catch (Exception ex) {
throw NSForwardException._runtimeExceptionForThrowable(ex);
            }

I use a version of this in my code: 
http://www.javaspecialists.eu/archive/Issue033.html



Inquiring minds...


Swallow, apparently.  :-P

Chuck


--
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to