I’m trying to figure out what is the right way to do this. Lets say you are making a new C++ Library called Foo. Should you just have a single exception for all errors from your library (FooException) or do people actually have custom ones: FooLoginFailedException, FooServerDownException, FooSomethingException…
Thanks!
You should have specific exceptions for specific failures, but they should all be derived from a single base exception type for your library. That way users of your library can choose whether to have specialized handling for specific types of failures, or just to treat all failures from your library the same. For example: