diff options
| author | Patrick Williams <patrick@stwcx.xyz> | 2016-11-15 14:26:25 -0600 |
|---|---|---|
| committer | Patrick Williams <patrick@stwcx.xyz> | 2016-11-17 15:36:21 -0600 |
| commit | 4a5c3b307cbbae9a462b8ba40a034f91fdef9dfd (patch) | |
| tree | b257b6692e4bae52526aa60c3b5196748f887885 /tools | |
| parent | d0cd9667701ee5d45257467d8b5391d557e191c9 (diff) | |
| download | sdbusplus-4a5c3b307cbbae9a462b8ba40a034f91fdef9dfd.tar.gz sdbusplus-4a5c3b307cbbae9a462b8ba40a034f91fdef9dfd.zip | |
sdbus++: Prepend all errors with 'Error' namespace
Old:
Error identifier: com.example.Interface.LogicError
Exception class: com::example::Interface::common::LogicError
New:
Error identifier: com.example.Interface.Error.LogicError
Exception class: com::example::Interface::Error::LogicError
Change-Id: I866046f4a0514f5bce40bdef46a218060d107765
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/example/net/poettering/Calculator.interface.yaml | 2 | ||||
| -rw-r--r-- | tools/sdbusplus/templates/error.mako.cpp | 4 | ||||
| -rw-r--r-- | tools/sdbusplus/templates/error.mako.hpp | 4 | ||||
| -rw-r--r-- | tools/sdbusplus/templates/method.mako.prototype.hpp | 6 |
4 files changed, 9 insertions, 7 deletions
diff --git a/tools/example/net/poettering/Calculator.interface.yaml b/tools/example/net/poettering/Calculator.interface.yaml index 4167c36..3c70cbc 100644 --- a/tools/example/net/poettering/Calculator.interface.yaml +++ b/tools/example/net/poettering/Calculator.interface.yaml @@ -40,7 +40,7 @@ methods: description: > The result of (x/y). errors: - - self.DivisionByZero + - self.Error.DivisionByZero - name: Clear description: > Reset the LastResult property to zero. diff --git a/tools/sdbusplus/templates/error.mako.cpp b/tools/sdbusplus/templates/error.mako.cpp index 933ddcb..62cc541 100644 --- a/tools/sdbusplus/templates/error.mako.cpp +++ b/tools/sdbusplus/templates/error.mako.cpp @@ -6,7 +6,7 @@ namespace sdbusplus namespace ${s} { % endfor -namespace common +namespace Error { % for e in error.errors: const char* ${e.name}::what() const noexcept @@ -15,7 +15,7 @@ const char* ${e.name}::what() const noexcept } % endfor -} // namespace common +} // namespace Error % for s in reversed(namespaces): } // namespace ${s} % endfor diff --git a/tools/sdbusplus/templates/error.mako.hpp b/tools/sdbusplus/templates/error.mako.hpp index 9f4f7f8..51f4860 100644 --- a/tools/sdbusplus/templates/error.mako.hpp +++ b/tools/sdbusplus/templates/error.mako.hpp @@ -8,7 +8,7 @@ namespace sdbusplus namespace ${s} { % endfor -namespace common +namespace Error { % for e in error.errors: @@ -22,7 +22,7 @@ struct ${e.name} : public sdbusplus::exception_t }; % endfor -} // namespace common +} // namespace Error % for s in reversed(namespaces): } // namespace ${s} % endfor diff --git a/tools/sdbusplus/templates/method.mako.prototype.hpp b/tools/sdbusplus/templates/method.mako.prototype.hpp index 20a4373..d9c1ec7 100644 --- a/tools/sdbusplus/templates/method.mako.prototype.hpp +++ b/tools/sdbusplus/templates/method.mako.prototype.hpp @@ -55,7 +55,9 @@ return e.split('.').pop(); def error_include(e): - return '/'.join(error_namespace(e).split('::')) + '/error.hpp'; + l = error_namespace(e).split('::') + l.pop() # Remove "Error" + return '/'.join(l) + '/error.hpp'; %> ### @@ -140,7 +142,7 @@ int ${interface_name()}::_callback_${ method.CamelCase }( return -EINVAL; } % for e in method.errors: - catch(sdbusplus::${error_namespace(e)}::common::${error_name(e)}& e) + catch(sdbusplus::${error_namespace(e)}::${error_name(e)}& e) { auto name = e.what(); sd_bus_error_set_const(error, name, name); |

