I have Azure Function (Http trigger) that can fail. I also have Application Insights configured for it.
In case of error (Which is better):
- Catch exception, wrap with more info and rethrow it. (Sends 500 response) OR
- Catch exception, log it, wrap it, rethrow it to caller. (Sends 500 response) OR
- Catch exception, log it (Don't throw it), Manual send 500 response.
Application Insight is able log exceptions. I don't really see point in logging error and throwing exception at the same time.
What are the guidelines? What is good practise?