Suppressing exception raised in Groovy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hussain123
    New Member
    • Jan 2007
    • 28

    Suppressing exception raised in Groovy

    First of all I am sorry to post this question here since I don't know where to post the question related to Groovy.Since it is much similar to JAVA i am posting it here.
    I am trying to connect to a database in GROOVY and if it fails then it should display an appropriate message on the screen.The entire code I have put it in a try-catch block.When the connection to the db fails my control goes to the catch block and in that catch block I am displaying my custom error message.But alongwith the custom error message the exception raised while connecting to the db is also shown.I don't want this exception to be displayed to the user.
    Does anyone have any idea why it is showing the exception too when I am not printing the exception raised?

    An help would be appreciated.

    Thanks in advance
    Hussain
  • N002199B
    New Member
    • Feb 2007
    • 41

    #2
    Originally posted by hussain123
    First of all I am sorry to post this question here since I don't know where to post the question related to Groovy.Since it is much similar to JAVA i am posting it here.
    I am trying to connect to a database in GROOVY and if it fails then it should display an appropriate message on the screen.The entire code I have put it in a try-catch block.When the connection to the db fails my control goes to the catch block and in that catch block I am displaying my custom error message.But alongwith the custom error message the exception raised while connecting to the db is also shown.I don't want this exception to be displayed to the user.
    Does anyone have any idea why it is showing the exception too when I am not printing the exception raised?

    An help would be appreciated.

    Thanks in advance
    Hussain
    Can you send a sample of your try catch block. I am of the feeling you are using the generic exeption error message appended with your custom one each time you display the error....

    It is just a hunch. How do you find Groovy though? Is it worth moving to

    Comment

    • N002199B
      New Member
      • Feb 2007
      • 41

      #3
      sorry, I meant your Catch Block

      Comment

      • hussain123
        New Member
        • Jan 2007
        • 28

        #4
        Hi
        This is the line for which it is displaying the exception on the screen and then going into the catch block.

        Code:
        	consConn.eachRow(consSql)
        The above code is in the try block where it is throwing the exception and displaying on the screen before going into the catch block.


        Regards,
        Hussain

        Comment

        Working...