Because without a try/catch, the code stops execution immediately when an exception happens. This can be bad for numerous reasons including:
- needing to dispose of objects
- rollback/commit database transactions
There are more, but this gives you a good idea. Try/Catch allows you to trap the exception, choose to handle it or not, then move on with life without crashing your program. Also, who really wants their code to just die because of a NullReferenceException? Even better, what if its an error that you cannot control, such as NetworkTimeout issues, premature HttpConnection closing, etc. It's just good practice to handle your errors where appropriate. This is not meant to say wrap your entire code block in a try/catch!!
If you still want to log to ELMAH even when you catch and handle an exception, you can do something like this:
try {
...
}
catch (Exception e) {
Elmah.ErrorSignal.FromCurrentContext().Raise(e)
}