catch exceptions as const
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If708716cc4c05ad30ea0fcd89518236d815bdafb
diff --git a/example/asio-example.cpp b/example/asio-example.cpp
index b1e1132..317deb5 100644
--- a/example/asio-example.cpp
+++ b/example/asio-example.cpp
@@ -288,7 +288,7 @@
message intMsg = conn->call(readyMsg);
intMsg.read(ready);
}
- catch (sdbusplus::exception::SdBusError& e)
+ catch (const sdbusplus::exception::SdBusError& e)
{
ready = 0;
// pause to give the server a chance to start up
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index 5994c25..43c0795 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -208,7 +208,7 @@
{
expandCall(yield, mcpy);
}
- catch (sdbusplus::exception::SdBusError& e)
+ catch (const sdbusplus::exception::SdBusError& e)
{
// Catch D-Bus error explicitly called by method handler
err = mcpy.new_method_errno(e.get_errno(), e.get_error());
@@ -637,7 +637,7 @@
#ifdef __EXCEPTIONS
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
return sd_bus_error_set(error, e.name(), e.description());
}
@@ -678,7 +678,7 @@
#ifdef __EXCEPTIONS
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
return sd_bus_error_set(error, e.name(), e.description());
}
@@ -711,7 +711,7 @@
#ifdef __EXCEPTIONS
}
- catch (sdbusplus::exception_t& e)
+ catch (const sdbusplus::exception_t& e)
{
return sd_bus_error_set(error, e.name(), e.description());
}
diff --git a/include/sdbusplus/bus.hpp b/include/sdbusplus/bus.hpp
index 2ffaa82..80ae4c4 100644
--- a/include/sdbusplus/bus.hpp
+++ b/include/sdbusplus/bus.hpp
@@ -347,7 +347,7 @@
{
call_noreply(m, timeout_us);
}
- catch (exception::SdBusError&)
+ catch (const exception::SdBusError&)
{
// Intentionally ignoring these sd_bus errors
}
diff --git a/include/sdbusplus/sdbuspp_support/server.hpp b/include/sdbusplus/sdbuspp_support/server.hpp
index 74f673a..e72575b 100644
--- a/include/sdbusplus/sdbuspp_support/server.hpp
+++ b/include/sdbusplus/sdbuspp_support/server.hpp
@@ -51,7 +51,7 @@
std::apply(f, std::move(arg));
}
}
- catch (sdbusplus::internal_exception_t& e)
+ catch (const sdbusplus::internal_exception_t& e)
{
return intf->sd_bus_error_set(error, e.name(), e.description());
}
@@ -124,7 +124,7 @@
// Indicate reply complete.
reply.method_return();
}
- catch (sdbusplus::internal_exception_t& e)
+ catch (const sdbusplus::internal_exception_t& e)
{
return intf->sd_bus_error_set(error, e.name(), e.description());
}