Why not catch std::exception and print the message? I think it will cover most of things.