sdbus++: catch exceptions as const
It is proper to `catch (const exception&)` and not the non-const
variant. Update the sdbus++ templates to ensure we always catch
as const.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ica0a6eda4e80bda868a4240a4a65584adabba22f
diff --git a/tools/sdbusplus/templates/method.prototype.hpp.mako b/tools/sdbusplus/templates/method.prototype.hpp.mako
index 640e74f..521ff63 100644
--- a/tools/sdbusplus/templates/method.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/method.prototype.hpp.mako
@@ -112,7 +112,7 @@
));
}
% for e in method.errors:
- catch(sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
+ catch(const sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
{
return o->_intf->sd_bus_error_set(error, e.name(), e.description());
}
diff --git a/tools/sdbusplus/templates/property.prototype.hpp.mako b/tools/sdbusplus/templates/property.prototype.hpp.mako
index e99eb7d..34c2f85 100644
--- a/tools/sdbusplus/templates/property.prototype.hpp.mako
+++ b/tools/sdbusplus/templates/property.prototype.hpp.mako
@@ -48,7 +48,7 @@
));
}
% for e in property.errors:
- catch(sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
+ catch(const sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
{
return o->_intf->sd_bus_error_set(error, e.name(), e.description());
}
@@ -99,7 +99,7 @@
));
}
% for e in property.errors:
- catch(sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
+ catch(const sdbusplus::${error_namespace(e)}::${error_name(e)}& e)
{
return o->_intf->sd_bus_error_set(error, e.name(), e.description());
}