Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program to watch another program

Status
Not open for further replies.

JontyMC

Programmer
Nov 26, 2001
1,276
GB
I've got a console app that occasionally throws up an error. I tried for ages to figure out the bug, but cannot track it down. I figure it may be some sort of SQL timeout, but not sure. Anyway....as a solution, I need to write another app to 'watch' the first one. If the first errors, I need to run it again, until it does work. How can I go about doing this?

Jon

"I don't regret this, but I both rue and lament it.
 
I'd rather catch the exception and log the full stack trace and then analyze the code. Hiding the errors under the carpet may help you but only in the short run.
 
The code is fine, the error I get is sql exception:

"General Network Error"

Which I'm guessing translates as 'flaky network'. Is there a way to catch the exception, then run the same code again, perhaps stopping after x attempts and notifying someone?

Jon

"I don't regret this, but I both rue and lament it.
 
If you're getting an exception, it'll be possible to catch it, either as a SqlException, or the generic System.Exception.

You can then implement delay & retry logic around it.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Thanks, thats what I ended up doing.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top