Getting error message in try catch (C#, Window Service) -


It is possible to get an error message in capturing the C # (or window service that was written with C #)

/ P>

  string input = console Readline (); While (Input! = "Q") {try {double result = 10 / int.Parse (input); Console.light line ("+ input +" divided by "and result is" + result); } Hold (exception) {Console.WriteLine ("error, please try again"); } Finally {input = Console.ReadLine (); }}   

This was created for the ".exe" program. If I input characters ("A", "B", "C") or zero, then the program will show the message "Error, Please try again" so that I should know the error message. I do not want to edit the code. I need a tool to detect all the errors in the program.

Thank you for your help.

You want to print the message property of your own Replace hold with:

  hold (exception e) {Console.WriteLine ("An exception occurred:" + E. Message); }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -