dodo
0.0.1
A C++ library to create containerized Linux services
|
Linux system error primitive to provide a consistent interface to Linux error codes. More...
#include <systemerror.hpp>
Public Types | |
enum | ErrorCode { ecOK = 0, ecEPERM = EPERM, ecENOENT = ENOENT, ecESRCH = ESRCH, ecEINTR = EINTR, ecEIO = EIO, ecENXIO = ENXIO, ecE2BIG = E2BIG, ecENOEXEC = ENOEXEC, ecEBADF = EBADF, ecECHILD = ECHILD, ecEAGAIN = EAGAIN, ecENOMEM = ENOMEM, ecEACCES = EACCES, ecEFAULT = EFAULT, ecENOTBLK = ENOTBLK, ecEBUSY = EBUSY, ecEEXIST = EEXIST, ecEXDEV = EXDEV, ecENODEV = ENODEV, ecENOTDIR = ENOTDIR, ecEISDIR = EISDIR, ecEINVAL = EINVAL, ecENFILE = ENFILE, ecEMFILE = EMFILE, ecENOTTY = ENOTTY, ecETXTBSY = ETXTBSY, ecEFBIG = EFBIG, ecENOSPC = ENOSPC, ecESPIPE = ESPIPE, ecEROFS = EROFS, ecEMLINK = EMLINK, ecEPIPE = EPIPE, ecEDOM = EDOM, ecERANGE = ERANGE, ecEDEADLK = EDEADLK, ecENAMETOOLONG = ENAMETOOLONG, ecENOLCK = ENOLCK, ecENOSYS = ENOSYS, ecENOTEMPTY = ENOTEMPTY, ecELOOP = ELOOP, ecEWOULDBLOCK = EWOULDBLOCK, ecENOMSG = ENOMSG, ecEIDRM = EIDRM, ecECHRNG = ECHRNG, ecEL2NSYNC = EL2NSYNC, ecEL3HLT = EL3HLT, ecEL3RST = EL3RST, ecELNRNG = ELNRNG, ecEUNATCH = EUNATCH, ecENOCSI = ENOCSI, ecEL2HLT = EL2HLT, ecEBADE = EBADE, ecEBADR = EBADR, ecEXFULL = EXFULL, ecENOANO = ENOANO, ecEBADRQC = EBADRQC, ecEBADSLT = EBADSLT, ecEDEADLOCK = EDEADLOCK, ecEBFONT = EBFONT, ecENOSTR = ENOSTR, ecENODATA = ENODATA, ecETIME = ETIME, ecENOSR = ENOSR, ecENONET = ENONET, ecENOPKG = ENOPKG, ecEREMOTE = EREMOTE, ecENOLINK = ENOLINK, ecEADV = EADV, ecESRMNT = ESRMNT, ecECOMM = ECOMM, ecEPROTO = EPROTO, ecEMULTIHOP = EMULTIHOP, ecEDOTDOT = EDOTDOT, ecEBADMSG = EBADMSG, ecEOVERFLOW = EOVERFLOW, ecENOTUNIQ = ENOTUNIQ, ecEBADFD = EBADFD, ecEREMCHG = EREMCHG, ecELIBACC = ELIBACC, ecELIBBAD = ELIBBAD, ecELIBSCN = ELIBSCN, ecELIBMAX = ELIBMAX, ecELIBEXEC = ELIBEXEC, ecEILSEQ = EILSEQ, ecERESTART = ERESTART, ecESTRPIPE = ESTRPIPE, ecEUSERS = EUSERS, ecENOTSOCK = ENOTSOCK, ecEDESTADDRREQ = EDESTADDRREQ, ecEMSGSIZE = EMSGSIZE, ecEPROTOTYPE = EPROTOTYPE, ecENOPROTOOPT = ENOPROTOOPT, ecEPROTONOSUPPORT = EPROTONOSUPPORT, ecESOCKTNOSUPPORT = ESOCKTNOSUPPORT, ecEOPNOTSUPP = EOPNOTSUPP, ecEPFNOSUPPORT = EPFNOSUPPORT, ecEAFNOSUPPORT = EAFNOSUPPORT, ecEADDRINUSE = EADDRINUSE, ecEADDRNOTAVAIL = EADDRNOTAVAIL, ecENETDOWN = ENETDOWN, ecENETUNREACH = ENETUNREACH, ecENETRESET = ENETRESET, ecECONNABORTED = ECONNABORTED, ecECONNRESET = ECONNRESET, ecENOBUFS = ENOBUFS, ecEISCONN = EISCONN, ecENOTCONN = ENOTCONN, ecESHUTDOWN = ESHUTDOWN, ecETOOMANYREFS = ETOOMANYREFS, ecETIMEDOUT = ETIMEDOUT, ecECONNREFUSED = ECONNREFUSED, ecEHOSTDOWN = EHOSTDOWN, ecEHOSTUNREACH = EHOSTUNREACH, ecEALREADY = EALREADY, ecEINPROGRESS = EINPROGRESS, ecESTALE = ESTALE, ecEUCLEAN = EUCLEAN, ecENOTNAM = ENOTNAM, ecENAVAIL = ENAVAIL, ecEISNAM = EISNAM, ecEREMOTEIO = EREMOTEIO, ecEDQUOT = EDQUOT, ecENOMEDIUM = ENOMEDIUM, ecEMEDIUMTYPE = EMEDIUMTYPE, ecECANCELED = ECANCELED, ecENOKEY = ENOKEY, ecEKEYEXPIRED = EKEYEXPIRED, ecEKEYREVOKED = EKEYREVOKED, ecEKEYREJECTED = EKEYREJECTED, ecEOWNERDEAD = EOWNERDEAD, ecENOTRECOVERABLE = ENOTRECOVERABLE, ecERFKILL = ERFKILL, ecEHWPOISON = EHWPOISON, ecEAI_BADFLAGS = EAI_BADFLAGS, ecEAI_NONAME = EAI_NONAME, ecEAI_AGAIN = EAI_AGAIN, ecEAI_FAIL = EAI_FAIL, ecEAI_NODATA = EAI_NODATA, ecEAI_FAMILY = EAI_FAMILY, ecEAI_SOCKTYPE = EAI_SOCKTYPE, ecEAI_SERVICE = EAI_SERVICE, ecEAI_ADDRFAMILY = EAI_ADDRFAMILY, ecEAI_MEMORY = EAI_MEMORY, ecEAI_SYSTEM = EAI_SYSTEM, ecEAI_OVERFLOW = EAI_OVERFLOW, ecEAI_INPROGRESS = EAI_INPROGRESS, ecEAI_CANCELED = EAI_CANCELED, ecEAI_NOTCANCELED = EAI_NOTCANCELED, ecEAI_ALLDONE = EAI_ALLDONE, ecEAI_INTR = EAI_INTR, ecEAI_IDN_ENCODE = EAI_IDN_ENCODE, ecLIBRARY_FIRST = 10000, ecSSL = 10002, ecSSL_ERROR_NONE = 10003, ecSSL_ERROR_ZERO_RETURN = 10003, ecSSL_ERROR_WANT_READ = 10004, ecSSL_ERROR_WANT_WRITE = 10005, ecSSL_ERROR_WANT_CONNECT = 10006, ecSSL_ERROR_WANT_ACCEPT = 10007, ecSSL_ERROR_WANT_X509_LOOKUP = 10008, ecSSL_ERROR_WANT_ASYNC = 10009, ecSSL_ERROR_WANT_ASYNC_JOB = 10010, ecSSL_ERROR_WANT_CLIENT_HELLO_CB = 10011, ecSSL_ERROR_SYSCALL = 10012, ecSSL_ERROR_PEERVERIFICATION = 10013 } |
Enumerate mimicking Linux error codes, integrates the EAI (addrinfo) ranges of errors. More... | |
Public Member Functions | |
SystemError () | |
Construct default with ecOK. More... | |
SystemError (ErrorCode e) | |
Construct from ErrorCode enumerate. More... | |
SystemError (int e) | |
Construct from system error code. More... | |
std::string | asString () const |
Get the system error string. More... | |
bool | ok () const |
Returns true when this->errorcode_ == ecOK. More... | |
operator int () const | |
Cast this SystemError to an int by taking error code_. More... | |
bool | operator!= (ErrorCode e) const |
Compare this SystemError to the ErrorCode e. More... | |
bool | operator!= (int e) const |
Compare this SystemError to the system error e. More... | |
bool | operator!= (SystemError e) const |
Compare this SystemError to the SystemError e. More... | |
SystemError & | operator= (ErrorCode e) |
Assign ErrorCode e. More... | |
SystemError & | operator= (int e) |
Assign system error e. More... | |
SystemError & | operator= (SystemError e) |
Assign SystemError e. More... | |
bool | operator== (const SystemError &e) const |
Compare this SystemError to the SystemError e. More... | |
bool | operator== (ErrorCode e) const |
Compare this SystemError to the ErrorCode e. More... | |
Static Public Member Functions | |
static std::string | libstrerror (SystemError error) |
Translate SystemErrors in library range. More... | |
Private Attributes | |
ErrorCode | errorcode_ |
Enumerate representation of the system error code. More... | |
Linux system error primitive to provide a consistent interface to Linux error codes.
The [[nodiscard]] attribute causes the compiler to issue a warning in case a SystemError is produced as r-value but not assigned to an l-value - encouraging more robust code by pinpointing omitted error checking.
Definition at line 53 of file systemerror.hpp.
Enumerate mimicking Linux error codes, integrates the EAI (addrinfo) ranges of errors.
Definition at line 59 of file systemerror.hpp.
|
inline |
Construct default with ecOK.
Definition at line 236 of file systemerror.hpp.
|
inline |
Construct from ErrorCode enumerate.
e | The ErrorCode to assign. |
Definition at line 242 of file systemerror.hpp.
|
inline |
Construct from system error code.
e | The int error to assign. |
Definition at line 248 of file systemerror.hpp.
|
inline |
Get the system error string.
Definition at line 322 of file systemerror.hpp.
Referenced by dodo::network::protocol::http::HTTPFragment::ParseResult::asString(), and dodo::network::TCPConnectionData::readBuffer().
|
inlinestatic |
Translate SystemErrors in library range.
error | The SystemError to translate. |
Definition at line 343 of file systemerror.hpp.
References ecSSL, ecSSL_ERROR_PEERVERIFICATION, and ecSSL_ERROR_SYSCALL.
|
inline |
Returns true when this->errorcode_ == ecOK.
Definition at line 254 of file systemerror.hpp.
Referenced by dodo::network::protocol::http::HTTPRequest::send(), and dodo::network::protocol::http::HTTPResponse::send().
|
inline |
Cast this SystemError to an int by taking error code_.
Definition at line 316 of file systemerror.hpp.
|
inline |
Compare this SystemError to the ErrorCode e.
e | The ErrorCode to compare to. |
Definition at line 268 of file systemerror.hpp.
|
inline |
Compare this SystemError to the system error e.
e | The int to compare to. |
Definition at line 261 of file systemerror.hpp.
|
inline |
Compare this SystemError to the SystemError e.
e | The SystemError to compare to. |
Definition at line 275 of file systemerror.hpp.
References errorcode_.
|
inline |
Assign ErrorCode e.
e | The ErrorCode to assign |
Definition at line 303 of file systemerror.hpp.
|
inline |
Assign system error e.
e | The int error to assign |
Definition at line 296 of file systemerror.hpp.
|
inline |
Assign SystemError e.
e | The SystemError to assign |
Definition at line 310 of file systemerror.hpp.
References errorcode_.
|
inline |
Compare this SystemError to the SystemError e.
e | The SystemError to compare to. |
Definition at line 289 of file systemerror.hpp.
References errorcode_.
|
inline |
Compare this SystemError to the ErrorCode e.
e | The error to compare to. |
Definition at line 282 of file systemerror.hpp.
|
private |
Enumerate representation of the system error code.
Definition at line 359 of file systemerror.hpp.
Referenced by operator!=(), operator=(), and operator==().