23#ifndef INCLUDE_HUEPLUSPLUS_HUE_EXCEPTION_H
24#define INCLUDE_HUEPLUSPLUS_HUE_EXCEPTION_H
29#include <nlohmann/json.hpp>
60 const char*
what()
const noexcept override;
76 std::string whatMessage;
99 const std::string&
GetAddress()
const noexcept;
112 static std::string GetMessage(
int error,
const std::string& addr,
const std::string& description);
117 std::string description;
Exception caused by a Hue API "error" response with additional information.
Definition HueException.h:84
const std::string & GetAddress() const noexcept
Address the API call tried to access.
Definition HueException.cpp:64
const std::string & GetDescription() const noexcept
Error description.
Definition HueException.cpp:69
static HueAPIResponseException Create(FileInfo fileInfo, const nlohmann::json &response)
Creates exception from API response.
Definition HueException.cpp:74
int GetErrorNumber() const noexcept
Error number from Hue API error response.
Definition HueException.cpp:59
Exception class with file information. Base class of all custom exception classes.
Definition HueException.h:50
const FileInfo & GetFile() const noexcept
Filename and line where the exception was thrown or caused by.
Definition HueException.cpp:36
const char * what() const noexcept override
What message of the exception.
Definition HueException.cpp:31
Namespace for the hueplusplus library.
Definition Action.h:28
Contains information about error location, use CURRENT_FILE_INFO to create.
Definition HueException.h:35
std::string filename
Current file name from FILE. Empty if unknown.
Definition HueException.h:37
int line
Current line number from LINE. -1 if unknown.
Definition HueException.h:39
std::string func
Current function from func. Empty if unknown.
Definition HueException.h:41
std::string ToString() const
String representation of func, file and line.
Definition HueException.cpp:104