xref: /openbmc/sdbusplus/docs/yaml/error.md (revision 44c6013c)
1# Error YAML
2
3D-Bus errors can be defined by creating a YAML file to describe the errors.
4From this YAML file, both documentation and binding code may be generated.
5The generated bindings are C++ exception types corresponding to the D-Bus
6error name. Ex. `org.freedesktop.Example.Error.SomeError` will create a
7generated exception type of
8`sdbusplus::org::freedesktop::Example::Error::SomeError` which may be thrown
9or caught as appropriate. If the error is thrown from an interface method
10which has specified it may return that error, then the bindings will generate
11a catch clause that returns a D-Bus error like
12"org.freedesktop.Example.Error.SomeError" to the method caller.
13
14The error YAML is simply a list of `name` along with optional `description`
15and `errno` properties.
16Example:
17
18```yaml
19- name: SomeError
20- name: AnotherError
21  description: >
22    This is another error.
23  errno: E2BIG
24```
25