summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <adamwheins@gmail.com>2015-06-01 21:57:18 -0400
committerAdam <adamwheins@gmail.com>2015-06-01 21:57:18 -0400
commitcea52ca43490b74316781c23779654fd46aaeab4 (patch)
tree4d3d925718427e80b0c1dc58a4a1007a2274c438
parentdb11e2919595aaed76a3af41c52722f41a3bcea9 (diff)
Exceptions do not take a string argument in their constructor.
-rw-r--r--c++.html.markdown4
1 files changed, 2 insertions, 2 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
index 5cd491b9..b214de7a 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -523,7 +523,7 @@ printMessage<10>(); // Prints "Learn C++ faster in only 10 minutes!"
// _catch_ handlers.
try {
// Do not allocate exceptions on the heap using _new_.
- throw std::exception("A problem occurred");
+ throw std::exception();
}
// Catch exceptions by const reference if they are objects
catch (const std::exception& ex)
@@ -614,7 +614,7 @@ void doSomethingWithAFile(const char* filename)
{
FILE* fh = fopen(filename, "r"); // Open the file in read mode
if (fh == nullptr)
- throw std::exception("Could not open the file.");
+ throw std::exception();
try {
doSomethingWithTheFile(fh);