Wednesday, January 29, 2014

Never throw ex just throw the exception.

today I got one error report from one of our users.then I examined the my log files. oops error stack traces were not logged properly.after few minutes I figure out what happen were there.In my some of methods I catch the exception and  throw ex instead of just throw.

from Stack over flow marc gravell

  • throw ex resets the stack trace (so your errors would appear to originate from HandleException)
  • throw doesn't - the original offender would be preserved.