1#pragma once
2
3#include <sdbusplus/exception.hpp>
4
5#include <cerrno>
6
7namespace ${error.namespaces}
8{
9    % for e in error.errors:
10struct ${e.CamelCase} final : public sdbusplus::exception::generated_exception
11{
12    static constexpr auto errName =
13        "${error.name}.Error.${e.name}";
14    static constexpr auto errDesc =
15        "${e.description.strip()}";
16    static constexpr auto errWhat =
17        "${error.name}.Error.${e.name}: ${e.description.strip()}";
18    % if e.errno:
19    static constexpr auto errErrno = ${e.errno};
20    % endif
21
22    const char* name() const noexcept override
23    {
24        return errName;
25    }
26    const char* description() const noexcept override
27    {
28        return errDesc;
29    }
30    const char* what() const noexcept override
31    {
32        return errWhat;
33    }
34    % if e.errno:
35    int get_errno() const noexcept override
36    {
37        return errErrno;
38    }
39    % endif
40};
41    % endfor
42} // namespace ${error.namespaces}
43
44#ifndef SDBUSPP_REMOVE_DEPRECATED_NAMESPACE
45namespace ${error.old_namespaces}
46{
47    % for e in error.errors:
48    using ${e.name} = ${error.namespaces}::${e.CamelCase};
49    % endfor
50} // namespace ${error.old_namespaces}
51#endif\
52