Hacker News new | past | comments | ask | show | jobs | submit login

do you have an example of what your talking about. I'm thinking even ugly things like input validation should be all in one spot and easy to follow and read. if there's a lot of weird state you need to track you can manage that in it's on class.



Yes, example time. I just wanted to make sure to get some general feedback first.

I have a tool that interacts with an ssh connection by emulating a terminal (keywords: spawn, expect, python-pexpect). The general case is you start the connection, send shell commands, and expect a prompt at the end. But what can also happen is that your connection gets closed in the middle of the interaction by the server ("Connection to <IP> closed by host."), that a timeout in my code, in the expect request, or in the ssh connection terminates, or that you get error messages like "broken pipe" with huge timeouts, etc. Then it might also happen that the shell command of the user has a syntax error. While I would argue the user should simply parse the output he receives, the user says he wants my framework to throw an exception to tell him about the syntax error. Adding all these cases has bloated my code a lot. And until now I only have three users.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: