Re: [twsocket] More friendly winsock exceptions
> *Subject:* Re: [twsocket] More friendly winsock exceptions > *From:* Stephen Dickason > *To:* ICS support mailing > > The bind error is the most annoying, ... > Definitely. The new friendly exceptions are in SVN and the overnight zip, implemented as Francois suggested so the application has access to several details about the error. But there is also a new property SocketErrs that defaults to the existing technical exceptions but can be changed to display (some) friendly exceptions. So no change for existing applications. But this is a work in progress, it's needs to be extended to more components and messages. Angus -- 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
Re: [twsocket] More friendly winsock exceptions
> Some of my applications actually parse that last message to look-up the > address and port for a more friendly response to the user. I would like that in my programs. > And that is the real issue here, are more friendly errors a benefit to ICS, > or will > they frustrate developers that already parse them into something better. Or > like me, do you rarely bother? Knowing what an error means is a big thing. And knowing that it's not your code and you don't have to code a bug-workaround cos of someone else's bug, bigger. > The bind error is the most annoying, ... Definitely. Stephen Dickason Senior Developer - Managed Services Email: sdicka...@elcb.co.za ELCB Information Services (Pty) Ltd Customer Service Email e...@elcb.co.za * www.elcb.co.za E A S T L O N D O N Tel: +27(43) 704 0700 Fax: +27(43) 704 0701 J O H A N N E S B U R G Tel: +27(11) 879 6179 Fax: +27(11) 454 0384 P O R T E L I Z A B E T H Tel: +27(41) 373 0529 Fax: +27(86) 650 0135 Disclaimer -- 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
Re: [twsocket] More friendly winsock exceptions
> We also have a long term problem with the OnError event. It skips raising an exception and > simply calls the event without the actual error information being available, and in a few > places continues program flow, not sure how useful this is, it probably confuses users. The OnError event can stay just like it is now and a new event OnException can be created with the instance of the TWSocketException so that every information is available. -- 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
Re: [twsocket] More friendly winsock exceptions
> 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. In principle I agree, although I'd add an option for the friendly error message to be the default instead of the standard error number version, to avoid massive application changes as well. However the implementation will not be easy, since there are multiple levels of handler the information passes through, RaiseException and SocketError, which all need changing. We also have a long term problem with the OnError event. It skips raising an exception and simply calls the event without the actual error information being available, and in a few places continues program flow, not sure how useful this is, it probably confuses users. Angus -- 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
Re: [twsocket] More friendly winsock exceptions
> 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
[twsocket] More friendly winsock exceptions
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 so you actually trace (maybe) the offending application. This is particularly annoying with MultiListen servers which say: Listening socket index #1 Address already in use (#10048 in Bind) and you've no idea which address relates to which index. Some of my applications actually parse that last message to look-up the address and port for a more friendly response to the user. And that is the real issue here, are more friendly errors a benefit to ICS, or will they frustrate developers that already parse them into something better. Or like me, do you rarely bother? The bind error is the most annoying, but others could be made more friendly. The LastError property will still give the real winsock error you want to report it. Angus -- 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