GetWinsockOrProxyErrorStr(ErrCode); // <== New function, not
related to this fix

I would name this function GetErrorMsgFromErrorCode since it is a
general translation from an error number to a message.

IMO, from the name it should be clear what range of error numbers
are expected to be translated. Maybe "GetWinsockOrProxyErrorMsgFromErrorCode".

Indeed, but then when another range is created, a new function has to be created as well. No a good idea IMO. Better to have a general purpose function to translate any error code to a message. We could also imagine an optional argument with a set of message ranges to check, defaulting to all ranges.

Probably the
implementation should as well call the API to get Windows error
message description from Windows error code.

Won't the API return localized messages?

Probably.
FormatMessage (http://msdn.microsoft.com/en-us/library/ms679351(v=VS.85).aspx) has a dwLanguageId argument but probably most Windows do not have all languages installed. Maybe english messages are always there ?

Not nice to have different
languages in log files or error messages.

Agreed. But difficult to reach in a real application involving a lot of components/libraries anyway.


generic. We still have the problem of colliding error code which
exists since the beginning.

Can't this be solved by introducing a range reserved for component users?
And by introducing a global unit containing all those constants used by
ICS which might lead to conflicts, that would help us a lot to keep overview?
I found for instance SmtpProtocolError = 20600 in SmtpProt.pas yesterday.

According to windows documentation (http://msdn.microsoft.com/en-us/library/ms681381(v=vs.85).aspx), system error code are in the range 0-15999. So the error number I selected long time ago doesn't collide with Windows.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to