I am working on a small c++ program and learning exceptions. Is the following code \"bad\", and if so, what can I do to improve it?
try { // code if
std::exception (or at least, std::runtime_error) contains a string, that can be accessed through the what() method. Best thing you can do is to use that, since it's standard, and other code can expect it, and since it serves your purpose anyway.
Better stick to the standard in this case.