Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: adjusted NCCE text

...

However, any change to the exception message literals involved will break the code. For example, if a maintainer were to edit the throw expression to read throw new suppose this code gets executed:

Code Block
throw new Exception("cannot find file

...

");

This exception should be handled by the first case clause, but it will be rethrown because the string does not match.

Furthermore, the exception would be rethrown by the code of the noncompliant code example rather than handled. Finally, exceptions may be thrown without a message.

...