+1  A: 

Derive all of your exceptions from a common base class BaseException that has a virtual method GetMessage().

Then catch(const BaseException& e).

Jesse Beder
+2  A: 

You should create a base exception class and have all of your specific exceptions derive from it:

class BaseException { };
class HourOutOfRangeException : public BaseException { };
class MinuteOutOfRangeException : public BaseException { };

You can then catch all of them in a single catch block:

catch (const BaseException& e) { }

If you want to be able to call GetMessage, you'll need to either:

  • place that logic into BaseException, or
  • make GetMessage a virtual member function in BaseException and override it in each of the derived exception classes.

You might also consider having your exceptions derive from one of the standard library exceptions, like std::runtime_error and use the idiomatic what() member function instead of GetMessage().

James McNellis
Thanks for all the help!
Alex
+1  A: 
Nikolai N Fetissov