blob: fe88fd092d6d6cb70600fe0d5973a71db7690da8 [file] [log] [blame]
Krzysztof Grobelny62c08e92022-09-16 10:28:53 +02001#include "errors.hpp"
2
3#include <system_error>
4
5namespace errors
6{
7
8using namespace std::literals::string_literals;
9
10InvalidArgument::InvalidArgument(std::string_view propertyNameArg) :
11 propertyName(propertyNameArg),
12 errWhatDetailed("Invalid argument was given for property: "s +
13 description())
14{}
15
16InvalidArgument::InvalidArgument(std::string_view propertyNameArg,
17 std::string_view info) :
18 propertyName(propertyNameArg),
19 errWhatDetailed(
20 ("Invalid argument was given for property: "s + description() + ". "s)
21 .append(info))
22{}
23
24const char* InvalidArgument::name() const noexcept
25{
26 return "org.freedesktop.DBus.Error.InvalidArgs";
27}
28
29const char* InvalidArgument::description() const noexcept
30{
31 return propertyName.c_str();
32}
33
34const char* InvalidArgument::what() const noexcept
35{
36 return errWhatDetailed.c_str();
37}
38
39int InvalidArgument::get_errno() const noexcept
40{
41 return static_cast<int>(std::errc::invalid_argument);
42}
43
44} // namespace errors