Why throwing an exceptions are bad idea in C#
What is an Exception?
Exceptions are a type of error that occurs during the execution of an application. Errors are typically problems that are not expected. Whereas, exceptions are expected to happen within the application’s code for various reasons.
An exception is something that does not follow a rule which makes it unexpected.
One case is when you should be throwing a standard exception. For example,
if your method takes a file name and is supposed to return a file, you should probably throw your platform's
standard FileNotFoundException rather than throw PeanutPowersFileNotFoundException
.
If you really want to throw your own exception,
you should probably have it extend the standard FileNotFoundException
.
Donn't throw an exception just handle it.
Why exceptions are a bad idea?