In my app Im using different open source libraries , that throws different exceptions .
I don’t have experience in dealing in way with exception handling ,I always just did the try/catch thing , when I know
there is problem .
Now I like to build some kind of object that handles all exceptions inside it . and I don’t have idea how to start and even if it possible
For example I have my class A and B
Class A
{
void method1()
{
Foo foo = new foo // external lib throws throw std::bad_alloc();
}
};
Class B
{
Void method1()
{
Int d = m_foo[0] // external lib throw std::runtime_error( message );
}
};
I want somehow to handle those kinds and others in central place in my application
What strategy should I use ?
UPDATE :
after trying the suggestion offered and implemented the try/catch in the main of my application , the problem it never gets there when the exception throws all im getting is this but its never gets to the try/catch:

You can use a
try... catchstructure in yourmain()function. All exceptions of the C++ standard library derive fromstd::exception, so that’s a good back up. However, you should discriminate all different kinds of exceptions, or at least, those more common. You can also create your own exceptions, as classes deriving fromstd::runtime_error. You can have multiple catch sections, but ordered from the one more specific to the more general one.Remember you need to #include
stdexceptandexception.Hope this helps.