Instead of creating a separate message function, just reuse what() and pass the string to the std::runtime_error constructor instead. Also catch a reference to a std::runtime_error instead, since it'll allow for simpler cleanup.