summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarri Devender Rao <devenrao@in.ibm.com>2017-05-14 08:33:39 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-06-03 13:07:31 +0000
commit99b33918fa65c3b46987543bcddec76d97beabcc (patch)
tree32e3aa06acadbe38567297d53062ef5bbc8d56b1
parentdf7cb5c008a98cfee81e7a01e97a81fba86213f0 (diff)
downloadphosphor-logging-99b33918fa65c3b46987543bcddec76d97beabcc.tar.gz
phosphor-logging-99b33918fa65c3b46987543bcddec76d97beabcc.zip
Remove inheriting from sdbus exception for error metadata
For logging/reporting exceptions, applications need to use exceptions generated by using sdbus++. For metadata, use header file generated by elog-gen script. Change-Id: Id8f61f8692bfd694d8875359d883465c1124bedf Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
-rw-r--r--tools/phosphor-logging/templates/elog-gen-template.mako.hpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp
index 6a3ffbf..670f8f5 100644
--- a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp
+++ b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp
@@ -79,6 +79,11 @@ struct ${b}
} // namespace _${classname}
<%
+ example_yaml = False
+ if("example.xyz.openbmc_project" in name):
+ example_yaml = True
+%>\
+<%
meta_string = ""
if(meta_list):
meta_string = ', '.join(meta_list)
@@ -100,12 +105,17 @@ struct ${b}
meta_string = parent_meta_short
parent = parents[parent]
- error_type = classname + " : public sdbusplus::exception_t"
+ if example_yaml:
+ error_type = classname + " : public sdbusplus::exception_t"
+ else:
+ error_type = classname
%>
struct ${error_type}
{
+ % if example_yaml:
static constexpr auto errName = "${name}";
static constexpr auto errDesc = "${error_msg[name]}";
+ % endif
static constexpr auto L = level::${error_lvl[name]};
% for b in meta_list:
using ${b} = _${classname}::${b};
@@ -115,6 +125,7 @@ struct ${error_type}
% endfor
using metadata_types = std::tuple<${meta_string}>;
+ % if example_yaml:
const char* name() const noexcept
{
return errName;
@@ -129,6 +140,7 @@ struct ${error_type}
{
return errName;
}
+ % endif
};
% for s in reversed(namespaces):
@@ -137,14 +149,14 @@ struct ${error_type}
<%
sdbusplus_name = name
- if("example.xyz.openbmc_project" not in name):
+ if not example_yaml :
sdbusplus_name = "sdbusplus." + sdbusplus_name
pos = sdbusplus_name.rfind(".")
sdbusplus_name = (sdbusplus_name[:pos] + ".Error." +
sdbusplus_name[pos+1:])
sdbusplus_type = sdbusplus_name.replace(".", "::")
phosphor_type = sdbusplus_type
- if("example.xyz.openbmc_project" not in name):
+ if not example_yaml :
phosphor_type = sdbusplus_type.replace("sdbusplus::", "")
phosphor_type = phosphor_type.replace("Error::", "")
%>\
OpenPOWER on IntegriCloud