I'm currently make a Helper class that can be used by multiple team members. Helper class uses third party API. And I have a question about that handles exceptions in the Helper class.
Looking at the link above, there is a subject like this:
Don't throw System.Exception, System.SystemException, System.NullReferenceException, or System.IndexOutOfRangeException intentionally from your own source code.
Don't create exceptions that can be thrown in debug mode but not release mode. To identify run-time errors during the development phase, use Debug Assert instead.
My question is:
If System.NullReferenceException or System.IndexOutOfRangeException is thrown in the method of Helper class, how should I handle it? Do nothing, and let the exception be propagated automatically? Or do I get the exception, add some information and rethrow it?
How do I handle the exception thrown by third party api? In this case too, should I get the exception, add the information, and then rethrow it?
It is told to use Debug Assert to identify runtime errors in release mode. Does this not apply to the Helper class?