> It's annoyed me for many years that many internet applications give unfriendly errors, > sometimes just five digit error codes, sometimes terse messages. > Specifically, when starting a server on an address and port that is being used, > the current ICS exception is: > Address already in use (#10048 in Bind) > I propose to change this to: > Another server is already listening on 192.168.1.120:80
This is not a bad idea but the implementation must be made so that no existing code is broken. It is likely that existing code rely on those specific error string. IMO the correct way to handle this enhancement is to extend ESocketException to add more fields with more details about the exception, without changing the current error message. Currently we simply have: ESocketException = class(Exception); It could become: ESocketException = class(Exception) private FIP : String; FPort : String; FProto : String; FErrorCode : Integer; FErrorMessage : string; public constructor Create(AErrorCode : Integer; const AErrorMessage : String; const AMessage : String; const AIP : String; const APort : String; const AProto : String); property property IP : String read FIP; property Port : String read FPort; property Proto : String read FProto; property ErrorCode : Integer read FErrorCode; property ErrorMessage : String read FErrorMessage; end; constructor EHTTPProtocolException.Create( AErrorCode : Integer; const AErrorMessage : String; const AMessage : String; const AIP : String; const APort : String; const AProto : String); begin FErrorCode := AErrorCode; FErrorMessage := AErrorMessage; FIP := AIP; FPort := APort; FProto := AProto; inherited Create(AMessage); end; The argument ErrorMessage shall be the current exception message so that current user code is not broken. Of course you may add more fields to better describe the exception and you may create a whole hierarchy, for example by high level protocol. -- 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