Instead, the method should itself gracefully handle any exceptions that may bubble up to it, attach as much contextual information as possible, and perform whatever logging or user communication is necessary, and ``++Exit++`` with a non-zero (i.e. non-success) exit code if necessary.
\[~nicolas.harraudeau] - this rule is not as useful for Java, where there's the ``++throws++`` keyword in the method signature if there is a call to a method that throws an exception. In C#, there's no such mechanism, so we can just look if there's a ``++throw++`` inside the method body. Is this useful enough?
=== on 30 Sep 2019, 10:45:16 Nicolas Harraudeau wrote:
\[~andrei.epure] indeed the value of this rule is lower. The only real-world use case I see is if there is a ``++throw++`` in a ``++try-catch++`` block and the exceptions caught do not match the one thrown. => Unintentional throw outside of the try-catch block. This is a corner case which will happen very rarely so there is no point in implementing the rule for C#.