1 #include "errors.hpp" 2 3 #include <system_error> 4 5 namespace errors 6 { 7 8 using namespace std::literals::string_literals; 9 InvalidArgument(std::string_view propertyNameArg)10InvalidArgument::InvalidArgument(std::string_view propertyNameArg) : 11 propertyName(propertyNameArg), 12 errWhatDetailed("Invalid argument was given for property: "s + 13 description()) 14 {} 15 InvalidArgument(std::string_view propertyNameArg,std::string_view info)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 name() const24const char* InvalidArgument::name() const noexcept 25 { 26 return "org.freedesktop.DBus.Error.InvalidArgs"; 27 } 28 description() const29const char* InvalidArgument::description() const noexcept 30 { 31 return propertyName.c_str(); 32 } 33 what() const34const char* InvalidArgument::what() const noexcept 35 { 36 return errWhatDetailed.c_str(); 37 } 38 get_errno() const39int InvalidArgument::get_errno() const noexcept 40 { 41 return static_cast<int>(std::errc::invalid_argument); 42 } 43 44 } // namespace errors 45