Skip to content

Instantly share code, notes, and snippets.

@piscisaureus
Created October 6, 2011 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piscisaureus/1266220 to your computer and use it in GitHub Desktop.
Save piscisaureus/1266220 to your computer and use it in GitHub Desktop.
const char* uv_strerror(uv_err_t err) {
switch (err.code) {
/* libuv specials */
case UV_OK: return "Success";
case UV_EOF: return "End of file";
case UV_ECHARSET: return "Charset conversion error";
/* Filling the gaps */
case UV_ENONET: "Machine is not on the network";
case UV_EPROTO: "Protocol error";
/* From BSD */
/* case UV_EPERM: return "Operation not permitted"; */
case UV_ENOENT: return "No such file or directory";
/* case UV_ESRCH: return "No such process"; */
case UV_EINTR: return "Interrupted system call";
/* case UV_EIO: return "Input/output error"; */
/* case UV_ENXIO: return "Device not configured"; */
/* case UV_E2BIG: return "Argument list too long"; */
/* case UV_ENOEXEC: return "Exec format error"; */
case UV_EBADF: return "Bad file descriptor";
/* case UV_ECHILD: return "No child processes"; */
/* case UV_EDEADLK: return "Resource deadlock avoided"; */
case UV_ENOMEM: return "Cannot allocate memory";
case UV_EACCESS: return "Permission denied";
case UV_EFAULT: return "Bad address";
/* case UV_ENOTBLK: return "Block device required"; */
case UV_EBUSY: return "Device busy";
case UV_EEXIST: return "File exists";
/* case UV_EXDEV: return "Cross-device link"; */
/* case UV_ENODEV: return "Operation not supported by device"; */
/* case UV_ENOTDIR: return "Not a directory"; */
/* case UV_EISDIR: return "Is a directory"; */
case UV_EINVAL: return "Invalid argument";
case UV_ENFILE: return "Too many open files in system";
case UV_EMFILE: return "Too many open files";
/* case UV_ENOTTY: return "Inappropriate ioctl for device"; */
/* case UV_ETXTBSY: return "Text file busy"; */
/* case UV_EFBIG: return "File too large"; */
/* case UV_ENOSPC: return "No space left on device"; */
/* case UV_ESPIPE: return "Illegal seek"; */
/* case UV_EROFS: return "Read-only file system"; */
/* case UV_EMLINK: return "Too many links"; */
case UV_EPIPE: return "Broken pipe";
/* case UV_EDOM: return "Numerical argument out of domain"; */
/* case UV_ERANGE: return "Result too large"; */
case UV_EAGAIN: return "Resource temporarily unavailable";
/* case UV_EINPROGRESS: return "Operation now in progress"; */
case UV_EALREADY: return "Operation already in progress";
case UV_ENOTSOCK: return "Socket operation on non-socket";
case UV_EDESTADDRREQ: return "Destination address required";
case UV_EMSGSIZE: return "Message too long";
case UV_EPROTOTYPE: return "Protocol wrong type for socket";
case UV_ENOPROTOOPT: return "Protocol not available";
case UV_EPROTONOSUPPORT: return "Protocol not supported";
/* case UV_ESOCKTNOSUPPORT: return "Socket type not supported"; */
/* case UV_EOPNOTSUPP: return "Operation not supported"; */
/* case UV_EPFNOSUPPORT: return "Protocol family not supported"; */
case UV_EAFNOSUPPORT: "Address family not supported by protocol family";
case UV_EADDRINUSE: return "Address already in use";
case UV_EADDRNOTAVAIL: return "Can't assign requested address";
case UV_ENETDOWN: return "Network is down";
case UV_ENETUNREACH: return "Network is unreachable";
/* case UV_ENETRESET: return "Network dropped connection on reset"; */
case UV_ECONNABORTED: return "Software caused connection abort";
case UV_ECONNRESET: return "Connection reset by peer";
case UV_ENOBUFS: return "No buffer space available";
case UV_EISCONN: return "Socket is already connected";
case UV_ENOTCONN: return "Socket is not connected";
case UV_ESHUTDOWN: return "Can't send after socket shutdown";
/* case UV_ETOOMANYREFS: return "Too many references"; */
case UV_ETIMEDOUT: return "Operation timed out";
case UV_ECONNREFUSED: return "Connection refused";
/* case UV_ELOOP: return "Too many levels of symbolic links"; */
/* case UV_ENAMETOOLONG: return "File name too long"; */
/* case UV_EHOSTDOWN: return "Host is down"; */
case UV_EHOSTUNREACH: return "No route to host";
/* case UV_ENOTEMPTY: return "Directory not empty"; */
/* case UV_EPROCLIM: return "Too many processes"; */
/* case UV_EUSERS: return "Too many users"; */
/* case UV_EDQUOT: return "Disc quota exceeded"; */
/* case UV_ESTALE: return "Stale NFS file handle"; */
/* case UV_EREMOTE: return "Too many levels of remote in path"; */
/* case UV_EBADRPC: return "RPC struct is bad"; */
/* case UV_ERPCMISMATCH: return "RPC version wrong"; */
/* case UV_EPROGUNAVAIL: return "RPC prog. not avail"; */
/* case UV_EPROGMISMATCH: return "Program version wrong"; */
/* case UV_EPROCUNAVAIL: return "Bad procedure for program"; */
/* case UV_ENOLCK: return "No locks available"; */
/* case UV_ENOSYS: return "Function not implemented"; */
/* case UV_EFTYPE: return "Inappropriate file type or format"; */
/* case UV_EAUTH: return "Authentication error"; */
/* case UV_ENEEDAUTH: return "Need authenticator"; */
/* case UV_EIDRM: return "Identifier removed"; */
/* case UV_ENOMSG: return "No message of desired type"; */
/* case UV_EOVERFLOW: return "Value too large to be stored in data type"; */
/* case UV_ECANCELED: return "Operation canceled"; */
/* case UV_EILSEQ: return "Illegal byte sequence"; */
/* case UV_ENOATTR: return "Attribute not found"; */
/* case UV_EDOOFUS: return "Programming error"; */
/* case UV_EBADMSG: return "Bad message"; */
/* case UV_EMULTIHOP: return "Multihop attempted"; */
/* case UV_ENOLINK: return "Link has been severed"; */
/* case UV_EPROTO: return "Protocol error"; */
/* case UV_ENOTCAPABLE: return "Capabilities insufficient"; */
/* case UV_ECAPMODE: return "Not permitted in capability mode"; */
/* From rfc 2553 */
/* case UV_EAIADDRFAMILY: return "Address family for nodename not supported"; */
/* case UV_EAIAGAIN: return "Temporary failure in name resolution"; */
/* case UV_EAIBADFLAGS: return "Invalid value for ai_flags"; */
/* case UV_EAIFAIL: return "Non-recoverable failure in name resolution"; */
case UV_EAIFAMILY: return "ai_family not supported";
/* case UV_EAIMEMORY: return "Memory allocation failure"; */
/* case UV_EAINODATA: return "No address associated with nodename"; */
case UV_EAINONAME: return "nodename nor servname provided, or not known";
case UV_EAISERVICE: return "servname not supported for ai_socktype";
case UV_EAISOCKTYPE: return "ai_socktype not supported";
/* case UV_EAISYSTEM: return "system error returned in errno"; */
default: return "Unknown error";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment