summaryrefslogtreecommitdiffhomepage
path: root/c++.html.markdown
diff options
context:
space:
mode:
authorAdam <adamwheins@gmail.com>2015-06-02 16:30:35 -0400
committerAdam <adamwheins@gmail.com>2015-06-02 16:30:35 -0400
commit894792e1e17173823a5d50de24439427c69d63f4 (patch)
tree8217cc7dd9a08de6382dc6c09453f1b99f3d24bf /c++.html.markdown
parent47d3cea47e8c5203efa857070a00dcfbff67b019 (diff)
Using std::runtime_error instead of std::exception.
Diffstat (limited to 'c++.html.markdown')
-rw-r--r--c++.html.markdown3
1 files changed, 2 insertions, 1 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index d049408a..6f4d2959 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -519,12 +519,13 @@ printMessage<10>(); // Prints "Learn C++ faster in only 10 minutes!"
// (see http://en.cppreference.com/w/cpp/error/exception)
// but any type can be thrown an as exception
#include <exception>
+#include <stdexcept>
// All exceptions thrown inside the _try_ block can be caught by subsequent
// _catch_ handlers.
try {
// Do not allocate exceptions on the heap using _new_.
- throw std::exception();
+ throw std::runtime_error("A problem occurred");
}
// Catch exceptions by const reference if they are objects
catch (const std::exception& ex)