We’re using socks.py to provide SOCKS proxying in some code at work, and it works great until it doesn’t. Then, unfortunately, the author didn’t try very hard to help us out.
Recently we got this exception:
GeneralProxyError: (5, "bad input")
Looking into the code, here’s where it raises that error:
if (type(destpair) in (list,tuple)==False) or (len(destpair)<2) or (type(destpair)!=str) or (type(destpair)!=int):
This is criminal: here is input validation, all of which focuses on a single variable, and when raising the exception, it doesn’t include the value of the variable! Ugh.
Error handling is no different than the rest of your product: you need to put yourself in your customer’s shoes and think about what they’ll need. Then give it to them. Simple.