locked
Application displays a dialog box when an exception occurs RRS feed

  • Question

  • I have a code with try/catch. When a exception (OracleException) occur, the application show a dialog box with the exception stacktrace. The application cannot show this dialog. How to inhibiting the dialog box? 

    Rodrigo

    Thursday, February 28, 2013 8:26 PM

Answers

  • In the Catch block, do not re-throw the exception. You can log the error, or whatever you need to do, but catching it will prevent the unhandled exception dialog.


    Bob - www.crowcoder.com

    • Marked as answer by Chester Hong Friday, March 8, 2013 10:06 AM
    Thursday, February 28, 2013 8:32 PM
  • > I have a code with try/catch

    Catching what Type of Exception?

    try 
    {
       // something that might go wrong 
    }
    catch( SomeException narrowestException )
    {
       // Handle this sort of Exception 
    }
    catch( someBiggerException widerException )
    {
       // Handle this sort of Exception 
    }
    catch( System.Exception widestException )
    {
       // Handle this sort of Exception 
    }
    
    Of course, you don't catch Exceptions that you can't do anything useful with.

    > When a exception (OracleException) occur, the application show a dialog box

    Presumably you're not catching these.


    Regards, Phill W.

    • Marked as answer by Chester Hong Friday, March 8, 2013 10:06 AM
    Friday, March 1, 2013 1:39 PM

All replies

  • In the Catch block, do not re-throw the exception. You can log the error, or whatever you need to do, but catching it will prevent the unhandled exception dialog.


    Bob - www.crowcoder.com

    • Marked as answer by Chester Hong Friday, March 8, 2013 10:06 AM
    Thursday, February 28, 2013 8:32 PM
  • > I have a code with try/catch

    Catching what Type of Exception?

    try 
    {
       // something that might go wrong 
    }
    catch( SomeException narrowestException )
    {
       // Handle this sort of Exception 
    }
    catch( someBiggerException widerException )
    {
       // Handle this sort of Exception 
    }
    catch( System.Exception widestException )
    {
       // Handle this sort of Exception 
    }
    
    Of course, you don't catch Exceptions that you can't do anything useful with.

    > When a exception (OracleException) occur, the application show a dialog box

    Presumably you're not catching these.


    Regards, Phill W.

    • Marked as answer by Chester Hong Friday, March 8, 2013 10:06 AM
    Friday, March 1, 2013 1:39 PM