Main Content

MISRA C++:2008 Rule 15-3-2

There should be at least one exception handler to catch all otherwise unhandled exceptions

Description

Rule Definition

There should be at least one exception handler to catch all otherwise unhandled exceptions.

Polyspace Implementation

The checker reports a violation if any of these conditions are true:

  • There is no try/catch in the main function.

  • The catch block does not include a catch-all (catch(...)) handler block.

The rule is not checked if a main function does not exist.

The checker does not determine if an exception of an unhandled type eventually propagates to main.

Troubleshooting

If you expect a rule violation but Polyspace® does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.

Check Information

Group: Exception Handling
Category: Advisory

Version History

Introduced in R2013b