Thread: default exception handling

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    default exception handling

    Hello everyone,


    For the default approach for a console application or Windows service written in C#, if there is an uncaught exception, the console application or the Windows service will terminate? Right?


    thanks in advance,
    George

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Does for me...
    It's not a that hard scenario to test
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks Magos,


    Glad you agree with me. :-)

    Quote Originally Posted by Magos View Post
    Does for me...
    It's not a that hard scenario to test

    regards,
    George

  4. #4
    Registered User
    Join Date
    Apr 2008
    Location
    USA
    Posts
    24

    Exceptional...

    Code:
    Try()
    {
    }
    
    Catch()
    {
    }
    
    Finally()
    {
    }
    Anything that the catch method could not handle will generally go unhandled unless you specify some conditionals like an if -- else or switch case within the catch method member. This is where you can set-up a safety net that will take all un-handled exceptions and bounce the application back to its feet or you can make a general handling rule that could output a message like "unknown exception occurred."

    If nothing is explicitly designed within the catch definition to handle a given exception then the application will step into the 'finally()' member for last minute instructions before terminating the application in question. This is where you will explicitly call methods to save work in progress and dispose of external service providers like browsers and notepads that your system called up during runtime.

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks TheRaven,


    I am interested, but seems never used before the below trick you mentioned, especially -- "an if -- else or switch case within the catch method member". Could you show some pseudo code please? So that I can learn from you.

    Quote Originally Posted by TheRaven View Post
    Anything that the catch method could not handle will generally go unhandled unless you specify some conditionals like an if -- else or switch case within the catch method member. This is where you can set-up a safety net that will take all un-handled exceptions and bounce the application back to its feet or you can make a general handling rule that could output a message like "unknown exception occurred."

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. signal handling and exception handling
    By lehe in forum C++ Programming
    Replies: 2
    Last Post: 06-15-2009, 10:01 PM
  2. Exception handling in a large project
    By EVOEx in forum C++ Programming
    Replies: 7
    Last Post: 01-25-2009, 07:33 AM
  3. exception handling
    By coletek in forum C++ Programming
    Replies: 2
    Last Post: 01-12-2009, 05:28 PM
  4. is such exception handling approach good?
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 12-27-2007, 08:54 AM
  5. Signal and exception handling
    By nts in forum C++ Programming
    Replies: 23
    Last Post: 11-15-2007, 02:36 PM