in which namespace / package to put exceptions

Posted by Fabiano on Stack Overflow See other posts from Stack Overflow or by Fabiano
Published on 2010-04-27T11:40:47Z Indexed on 2010/04/27 11:43 UTC
Read the original article Hit count: 461

Hi

What is the common or best practice to structure the location of your exception classes?

Let's say you have the packages/namespaces myproject.person (models and DAOs for persons) and myproject.order (models and DAOs for orders) and the exceptions PersonException and OrderException. Should I put the exceptions in their corresponding packages or in a separate package for exceptions (e.g. myproject.exceptions)?

The first approach seems more reasonable (because it's sorted by functionality). But there the question arises where you should put exceptions that are related to both? e.g. a ConstraintViolationException

Thanks

© Stack Overflow or respective owner

Related posts about exception

Related posts about c#