sdbus++: events: create event classes
Generate an equivalent amount of exception class as the `errors.yaml`
supported and convert the examples to use it.
Tested:
```
‣ Type=error Endian=l Flags=1 Version=1 Cookie=9 ReplyCookie=2 Timestamp="Tue 2024-09-17 18:21:35.649674 UTC"
Sender=:1.2489 Destination=:1.2495
ErrorName=net.poettering.Calculator.DivisionByZero ErrorMessage="Attempted to divide by zero."
UniqueName=:1.2489
MESSAGE "s" {
STRING "Attempted to divide by zero.";
};
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I4b2671838639d1e8be1ccdf655b699a98b9c2116
diff --git a/example/calculator-aserver.cpp b/example/calculator-aserver.cpp
index 33a582a..7a5051e 100644
--- a/example/calculator-aserver.cpp
+++ b/example/calculator-aserver.cpp
@@ -21,7 +21,7 @@
auto method_call(divide_t, auto x,
auto y) -> sdbusplus::async::task<divide_t::return_type>
{
- using sdbusplus::error::net::poettering::calculator::DivisionByZero;
+ using sdbusplus::error::net::poettering::Calculator::DivisionByZero;
if (y == 0)
{
status(State::Error);
diff --git a/example/calculator-server.cpp b/example/calculator-server.cpp
index 7ee4218..2d0efca 100644
--- a/example/calculator-server.cpp
+++ b/example/calculator-server.cpp
@@ -1,5 +1,4 @@
#include <net/poettering/Calculator/client.hpp>
-#include <net/poettering/Calculator/error.hpp>
#include <net/poettering/Calculator/server.hpp>
#include <sdbusplus/server.hpp>
@@ -29,7 +28,7 @@
*/
int64_t divide(int64_t x, int64_t y) override
{
- using sdbusplus::error::net::poettering::calculator::DivisionByZero;
+ using sdbusplus::error::net::poettering::Calculator::DivisionByZero;
if (y == 0)
{
status(State::Error);
diff --git a/example/yaml/net/poettering/Calculator.interface.yaml b/example/yaml/net/poettering/Calculator.interface.yaml
index f130e59..affc2d4 100644
--- a/example/yaml/net/poettering/Calculator.interface.yaml
+++ b/example/yaml/net/poettering/Calculator.interface.yaml
@@ -40,7 +40,7 @@
description: >
The result of (x/y).
errors:
- - self.Error.DivisionByZero
+ - self.DivisionByZero
- name: Clear
flags:
- unprivileged
@@ -65,7 +65,7 @@
description: >
The name of the owner of the Calculator.
errors:
- - self.Error.PermissionDenied
+ - self.PermissionDenied
signals:
- name: Cleared
description: >