Where to define exception classes, inside classes or on a higher level?
- by rve
Should exception classes be part of the class which may throw them or should they exist on a higher level?
For example :
class Test
{
public:
class FooException: public ExceptionBase { };
void functionThrowingFooException();
};
or
class FooException: public ExceptionBase { };
class Test
{
public:
void functionThrowingFooException();
};
(functionThrowingFooException() is the only function to ever throw a FooException)