Bug #7367 User-friendly error messages for socket errors
Submitted: 16 Dec 2004 22:11 Modified: 21 Feb 2006 11:14
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S4 (Feature request)
Version:* OS:Any (*)
Assigned to: CPU Architecture:Any

[16 Dec 2004 22:11] Olaf van der Spek
Description:
Hi,

When the server is unreachable, the client library says: "Can't connect to MySQL server on 'holafb' (10061)".
Would it be possible to replace the number with a string, like with this function?

string Csocket::error2a(int v)
{
	switch (v)
	{
	case WSAEADDRINUSE: return "EADDRINUSE";
	case WSAEADDRNOTAVAIL: return "EADDRNOTAVAIL";
	case WSAEAFNOSUPPORT: return "EAFNOSUPPORT";
	case WSAEALREADY: return "EALREADY";
	case WSAECONNABORTED: return "ECONNABORTED";
	case WSAECONNREFUSED: return "ECONNREFUSED";
	case WSAECONNRESET: return "ECONNRESET";
	case WSAEDESTADDRREQ: return "EDESTADDRREQ";
	case WSAEDQUOT: return "EDQUOT";
	case WSAEHOSTDOWN: return "EHOSTDOWN";
	case WSAEHOSTUNREACH: return "EHOSTUNREACH";
	case WSAEINPROGRESS: return "EINPROGRESS";
	case WSAEISCONN: return "EISCONN";
	case WSAELOOP: return "ELOOP";
	case WSAEMSGSIZE: return "EMSGSIZE";
	case WSAENAMETOOLONG: return "ENAMETOOLONG";
	case WSAENETDOWN: return "ENETDOWN";
	case WSAENETRESET: return "ENETRESET";
	case WSAENETUNREACH: return "ENETUNREACH";
	case WSAENOBUFS: return "ENOBUFS";
	case WSAENOPROTOOPT: return "ENOPROTOOPT";
	case WSAENOTCONN: return "ENOTCONN";
	case WSAENOTEMPTY: return "ENOTEMPTY";
	case WSAENOTSOCK: return "ENOTSOCK";
	case WSAEOPNOTSUPP: return "EOPNOTSUPP";
	case WSAEPFNOSUPPORT: return "EPFNOSUPPORT";
	case WSAEPROTONOSUPPORT: return "EPROTONOSUPPORT";
	case WSAEPROTOTYPE: return "EPROTOTYPE";
	case WSAEREMOTE: return "EREMOTE";
	case WSAESHUTDOWN: return "ESHUTDOWN";
	case WSAESOCKTNOSUPPORT: return "ESOCKTNOSUPPORT";
	case WSAESTALE: return "ESTALE";
	case WSAETIMEDOUT: return "ETIMEDOUT";
	case WSAETOOMANYREFS: return "ETOOMANYREFS";
	case WSAEUSERS: return "EUSERS";
	case WSAEWOULDBLOCK: return "EWOULDBLOCK";
	}
	char b[12];
	sprintf(b, "%d", v);
	return b;
}

How to repeat:
-
[21 Feb 2006 11:14] Valeriy Kravchuk
Thank you for a reasonable feature request.