Programming Tip for the day – Hiding Exceptions

Hello Programmers,

 

Hiding exceptions is a sin.  Don’t do it unless you want to be tagged as a bad developer.

If you don’t understand what I am talking about, here is the code snippet.

try catch
Try catch

try

{

int i = 10/0;

}

catch(Exception e)

{

//Do Nothing – Please don’t do this!!

}

 

Moral: Always throw the exceptions and log them.  It will get incredibly hard to spot the issue while debugging if you try to hide the exceptions.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s