-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blocking connection timeout/failure gives wrong error message #3
Comments
Thanks for the post, I'll fix this. |
sorry for the delay on this, the more I read the MS-docs site, the more I wonder if this lib needs a rewrite, or at least deeper changes for better error handling. Some of my old examples, that I thought were simple, aren't actually working anymore (ie. connecting to google). Is that error msg the only issue in your opinion? Does this lib work sufficiently apart from that error msg? |
Sorry to prompt you again, I finally traced the logic I was using for how that error to come about. I actually have a function that records the last error code, and it's descriptor ( Socket error info is recorded here:
These properties are updated after every method call that would return a winsock error code. I figured that if an error were thrown for every Winsock error, then the lib would be less useful for a robust application. I actually intended for the user to check the errors after an operation and handle them accordingly. Should I instead throw an error for every winsock error? Or simply take this throw out? Which do you think would be more useful? Incidentally, I of course didn't intend this particular error to be thrown on connect fail. It seems I was overzealous in this case, and the actual error, in the case of a timeout, has little or no relation to this particular error being thrown. I'm leaning toward just taking this instance of |
My only care was that the misleading message caused some time to be wasted while I was troubleshooting. So far I've only used the script to send a short string of commands over telnet. Once I got it working, I have used it very frequently (to turn my AV receiver on/off) and have not encountered any issues. I would suggest throwing for any failure by default, but doing it via a method which the user can override. If a user wants to use v1-style error checking, they can implement it by overriding the method (or setting a callback, or whatever mechanism you choose).
It matters not to me; I only go through my GitHub notifications on rare occasions. I have them automatically filed away to eliminate unwanted distractions. |
Ok, maybe something like this then?
|
I don't know what you mean. My suggestion is to simply define a method which throws; e.g. usage like |
Ok, I'll add that Edit: I'll leave the callback for the coder as you suggested earlier. |
When this eventually times out (due to nothing listening at that address/port), it gives a misleading/incorrect error message:
The text was updated successfully, but these errors were encountered: