10 #include "xxhrtypes.hpp"
11 #include "defines.hpp"
18 BETTER_ENUM(ErrorCode,
unsigned int,
24 HOST_RESOLUTION_FAILURE,
27 NETWORK_RECEIVE_ERROR,
29 PROXY_RESOLUTION_FAILURE,
31 SSL_LOCAL_CERTIFICATE_ERROR,
32 SSL_REMOTE_CERTIFICATE_ERROR,
48 Error() : code{ErrorCode::OK} {}
49 Error(ErrorCode code) : code{code} {}
51 explicit operator bool()
const {
52 return code != +ErrorCode::OK;
58 operator std::string()
const {
60 ss <<
"error:" <<
static_cast<unsigned int>(this->code) <<
" " << this->code._to_string();
65 inline std::ostream& operator<<(std::ostream& os,
const Error& err) {
66 os << std::string(err);