Hi everyone,

I would go for option 2 and subclass the CDKException - that way the
exceptions are more informative. You can have different cases of
illegal arguments being passed to a method and it's easier to handle
these using custom exceptions than using the IllegalArgumentException
with a different message.

Also, IllegalArgumentException is an unchecked exception while
CDKException is not. It may not be the best idea to mix these two.

Kind regards,
Christian

On Wed, Jul 6, 2011 at 11:35 AM, Nina Jeliazkova
<jeliazkova.n...@gmail.com> wrote:
> Hello Egon,
>
> On 6 July 2011 13:06, Egon Willighagen <egon.willigha...@gmail.com> wrote:
>>
>> Hi developers *and* users,
>>
>> shall we try to come up with a good Exception design for master?
>>
>> Currently, the CDK uses a mix of various CDK specific exceptions,
>> though we officially promote the single use of CDKException. Others
>> have requested to use more general exceptions, like
>> IllegalArgumentException.
>>
>> Today, another user problem came up, a NPE upon missing 2D coordinates
>> in the renderer, where in fact a IllegalArgumentException may be
>> appropriate, with a good error message.
>>
>> I like to discuss this issue, and in particular these three designs:
>>
>> 1. Only CDKException with proper messages (current formal design of
>> the CDK, which several classes violate)
>> 2. Use CDK-specific, tuned exceptions, such as NoSuchAtomTypeException
>> (existing already) and Missing2DCoordinatesException
>> 3. Use Java Exceptions only, like IllegalArgumentException with proper
>> messages
>>
>> There are pros and cons for all of them. Let's try to get them clear
>> first.
>
> 1) and 2) are not mutually exclusive.
> My preference would be for 1) CDKException but combined with 2) CDKException
> subclasses , e.g. NoSuchAtomTypeException should extend  CDKException class.
>  This will leave a freedom for the code to catch the top level or the more
> specific exception.
> Dropping CDK specific exceptions and sticking to 3) only , will likely
> complicate troubleshooting in more complex environment, as a generic Java
> exception might come from elsewhere, and will be harder work to blame the
> CDK code in case of failure ;)
> Regards,
> Nina
>
>>
>> Egon
>>
>>
>> --
>> Dr E.L. Willighagen
>> Postdoctoral Researcher
>> Institutet för miljömedicin
>> Karolinska Institutet (http://ki.se/imm)
>> Homepage: http://egonw.github.com/
>> LinkedIn: http://se.linkedin.com/in/egonw
>> Blog: http://chem-bla-ics.blogspot.com/
>> PubList: http://www.citeulike.org/user/egonw/tag/papers
>>
>>
>> ------------------------------------------------------------------------------
>> All of the data generated in your IT infrastructure is seriously valuable.
>> Why? It contains a definitive record of application performance, security
>> threats, fraudulent activity, and more. Splunk takes this data and makes
>> sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-d2d-c2
>> _______________________________________________
>> Cdk-devel mailing list
>> cdk-de...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/cdk-devel
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to