CAn unused exception variable when catching all exceptions

Posted by b0x0rz on Stack Overflow See other posts from Stack Overflow or by b0x0rz
Published on 2010-05-30T16:35:07Z Indexed on 2010/05/30 16:42 UTC
Read the original article Hit count: 178

Filed under:
|
|

what is a best practice in cases such as this one:

try
{
   // do something
}
catch (SpecificException ex)
{
    Response.Redirect("~/InformUserAboutAn/InternalException/");
}

the warning i get is that ex is never used.

however all i need here is to inform the user, so i don't have a need for it.

do i just do:

try
{
   // do something
}
catch
{
    Response.Redirect("~/InformUserAboutAn/InternalException/");
}

somehow i don't like that, seems strange!!? any tips? best practices?

what would be the way to handle this.

thnx

© Stack Overflow or respective owner

Related posts about c#

Related posts about best-practices