[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Who should log an Exception

Although this is quite a general question, I think it appears especially important in such a diverse environment as the Eclipse Platform:

In my plug-in I invoke some code of another plug-in. This code might throw an exception that I'd catch in my plug-in. I log that exception to make sure it doesn't get lost. Now it happens to be the case that the other plug-in also logged that exception (in this concrete case I refer to org.eclipse.core.ant.AntRunner) so I get the same thing twice in the error log.

Here are the two approaches that I think of. AntRunner would take the first one.

1. Log the exception as soon as possible. So the callee is responsible of logging it before passing it to the caller.

2. If you throw it, don't log it.

Any thoughts? I guess there's no 'right' one, but maybe the AntRunner case is just the one that's generally been followed?

Thanks.
Felix