15

...
catch (Exception)
{
throw new Exception();
}
finally
{
//CloseConnection();
}

Why? Oh Why????

Comments
  • 0
    Because that way you can inform methds that this exception in the catch block has to be thrown.
  • 0
    I should add, that in the try-block there is some database action going on, and there the exception occurs. How should I know what went wrong in the database on the clients PC if nothing is catched and logged?
    Not to speak of the commented "CloseConnection()" 😠
  • 0
    @katho2404
    Server side logging and user error reporting is your answer ;) also what is wrong with closing the connection besides the naming convention amd the fact that its commented out?
  • 0
    It's the fact that it's commented out!
    And it's a local database at the user's PC.
    Unfortunately most of the catch blocks, if there are any, look like this or similar. There is not really any usable logging.
  • 0
    Then make the user to send logs that you append to a file or smth or make the software upload it to your remote server. Local database is not a very good practice tho. Well it depends on the application tho. But the fact that the connection is not closed bothers me aswell
  • 0
    The local database is necessary for the application. It's a 10 year old WinForms project, handed on from dev to dev... The code looks like it too..
    But yeah, your idea was what I was going to do ;)
  • 0
    my eyeeessss!!!!! it burnzzzzzzzz!!!!
Add Comment