summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2021-10-06 20:39:54 +0300
committerPatrick Williams <patrick@stwcx.xyz>2021-10-06 20:39:54 +0300
commitc5967048de7c5361b1537af47768a87ffb463d28 (patch)
tree3af817b73274e90b7073272b2c7d72ae8156c185
parentd32c4fa936f9a88fc1dd124201ed11a6a90a18c5 (diff)
downloadbmcweb-c5967048de7c5361b1537af47768a87ffb463d28.tar.xz
catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I93925bf34b4fec181a56d6524cbe9c6182a16b1f
-rw-r--r--http/routing.hpp2
-rw-r--r--src/crow_test.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/http/routing.hpp b/http/routing.hpp
index d2a10b297c..5d9c8e307c 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -1204,7 +1204,7 @@ class Router
{
rules[ruleIndex]->handleUpgrade(req, res, std::move(adaptor));
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
BMCWEB_LOG_ERROR << "An uncaught exception occurred: " << e.what();
res.result(boost::beast::http::status::internal_server_error);
diff --git a/src/crow_test.cpp b/src/crow_test.cpp
index a6852203a2..0df05d2ad7 100644
--- a/src/crow_test.cpp
+++ b/src/crow_test.cpp
@@ -58,7 +58,7 @@ TEST(Crow, Rule)
r.validate();
fail("empty handler should fail to validate");
}
- catch (runtime_error& e)
+ catch (const runtime_error& e)
{}
int x = 0;
@@ -412,7 +412,7 @@ TEST(Crow, server_handling_error_request)
c.receive(asio::buffer(buf, 2048));
fail();
}
- catch (std::exception& e)
+ catch (const std::exception& e)
{
// std::cerr << e.what() << std::endl;
}
@@ -891,7 +891,7 @@ TEST(Crow, routeDynamic)
app.routeDynamic("/invalid_test/<double>/<path>")([]() { return ""; });
fail();
}
- catch (std::exception&)
+ catch (const std::exception&)
{}
// app is in an invalid state when routeDynamic throws an exception.
@@ -900,7 +900,7 @@ TEST(Crow, routeDynamic)
app.validate();
fail();
}
- catch (std::exception&)
+ catch (const std::exception&)
{}
{