Hi, I'm Pete. Welcome to JustAnswer! I'm reviewing your question now, and will post back with your reply ASAP.
What is the exact error message you are getting?
Can I remotely connect to your computer, so I can troubleshoot this issue with you?
This error is popped on network disconnect? If so it is a system message, in debugging I normally pipe those to console, or silence the terminal return, but if it is one of those pops that requires user input for it to go away,it may be impossible to catch the exception, as that error pops from outside your code itself. Sounds like the standard notification service. For the database management console, and at that point you would need to see if you can "try catch" in your code, that is a little easier since you do know which error is need g handling. See the following URL for that and other methods, and code examples. :)