summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2021-09-03 16:27:12 +0300
committerEd Tanous <ed@tanous.net>2021-09-03 22:15:18 +0300
commitbd078c3b730914fb4edc46717d92106d49d6c4b8 (patch)
treebccdc7f3f312bdd2dcf2c91e4d30a749f14a0e3f /src
parenta1978347588642a9677eca4d96d2a89e93d225a0 (diff)
downloadbmcweb-bd078c3b730914fb4edc46717d92106d49d6c4b8.tar.xz
exception: catch by reference
`catch` should always be done by reference to avoid object slicing and excess copy-constructor calls. Preference is for exceptions to also be caught 'const'. (Both of these come from the C++ Core Guidelines) Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I7753abbef218a87ceecbd068245c14f413fadabc
Diffstat (limited to 'src')
-rw-r--r--src/kvm_websocket_test.cpp4
-rw-r--r--src/security_headers_middleware_test.cpp2
-rw-r--r--src/token_authorization_middleware_test.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/kvm_websocket_test.cpp b/src/kvm_websocket_test.cpp
index 4016329486..c01b7e5582 100644
--- a/src/kvm_websocket_test.cpp
+++ b/src/kvm_websocket_test.cpp
@@ -40,7 +40,7 @@ TEST(Kvm, BasicRfb)
c.close();
break;
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing. We expect this to fail while the server is
// starting up
@@ -111,4 +111,4 @@ TEST(Kvm, BasicRfb)
EXPECT_EQ(open_string, "RFB 003.008");
app.stop();
-} \ No newline at end of file
+}
diff --git a/src/security_headers_middleware_test.cpp b/src/security_headers_middleware_test.cpp
index f5cd3d5a83..80df725458 100644
--- a/src/security_headers_middleware_test.cpp
+++ b/src/security_headers_middleware_test.cpp
@@ -33,7 +33,7 @@ TEST(SecurityHeaders, TestHeadersExist)
c.close();
break;
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing. We expect this to fail while the server is
// starting up
diff --git a/src/token_authorization_middleware_test.cpp b/src/token_authorization_middleware_test.cpp
index fcb5b65e80..a93f8c8ff3 100644
--- a/src/token_authorization_middleware_test.cpp
+++ b/src/token_authorization_middleware_test.cpp
@@ -89,7 +89,7 @@ TEST(TokenAuthentication, TestRejectedResource)
c.connect(asio::ip::tcp::endpoint(
asio::ip::address::from_string("127.0.0.1"), 45451));
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing
}
@@ -123,7 +123,7 @@ TEST(TokenAuthentication, TestGetLoginUrl)
c.connect(asio::ip::tcp::endpoint(
asio::ip::address::from_string("127.0.0.1"), 45451));
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing
}
@@ -169,7 +169,7 @@ TEST(TokenAuthentication, TestPostBadLoginUrl)
c.close();
break;
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing. We expect this to fail while the server is
// starting up
@@ -259,7 +259,7 @@ TEST(TokenAuthentication, TestSuccessfulLogin)
c.close();
break;
}
- catch (std::exception e)
+ catch (const std::exception& e)
{
// do nothing. We expect this to fail while the server is
// starting up