Why not to use try exception in C# service

I was working on a REST service for a client and then that service was being used by a third party to throw huge data in it.

Couple of methods we being called and everything seemed to work fine however we noticed that some records were not added and third party was not being notified and all looked like it was inserting data with out any issues and there were not trace being logged.

After some investigation figured out that we had try exception block and in exception rather than throwing exception it was just letting it pass without throwing any error so client had no idea about this error and it was not being logged anywhere.

We removed this and then we were able to see all exception and traces were being logged.

This migth not work in all scenarios however in Services we definitely need to log either trace or notify 3rd party about the error.

Comments are closed.