When You Forget to Throw, Your Code Will Blow | HackerNoon
Briefly

The article highlights the crucial importance of throwing exceptions when they are created in code. Failing to do so can result in silent failures where critical errors are ignored, leading to misleading program behavior. It emphasizes that exceptions should be treated similarly to business objects, ensuring that they are always thrown to preserve the logic of error handling. To combat this issue, developers are encouraged to utilize linters and conduct thorough tests on exception paths for a more reliable error handling strategy.
When you create a new exception but forget to throw it, your code might appear to work correctly, but it silently ignores critical errors.
An exception represents a real-world failure inside your program. If you create an exception but never throw it, your code lies about the presence of an error.
Creating exceptions is the same as creating business objects and constructors should not have side effects. Unless you throw them, it is dead code.
Automated linters and static analyzers can flag such issues, ensuring that all exceptions are accounted for and appropriately handled.
Read at Hackernoon
[
|
]