Placing exceptions in their own subpackage?

In the current package I'm working on for a project, I have about 13 different user exceptions. Is it a good idea to put them in your own subpackage under a package that has all the classes that will use these exceptions?

For instance:

com.company.project.core

contains a bunch of classes that may throw some custom exceptions, which are then placed inside

com.company.project.core.exception

The only drawback that I see now is that I have a little import left for classes using exceptions.

+3
source share
4 answers

, , . , , .

, base-exception, . - MyProjectException.

+6

, - , IDE , .

, RuntimeExceptions .

+2

, . , .

- API, , . , JDK .

+1

, , , - . . core.exceptions , , Mnementh.

-2

Source: https://habr.com/ru/post/1735223/


All Articles