Exceptions and Error Handling (ERR)
- ERR50-CPP. Do not abruptly terminate the program
- ERR51-CPP. Handle all exceptions
- ERR52-CPP. Do not use setjmp() or longjmp()
- ERR53-CPP. Do not reference base classes or class data members in a constructor or destructor function-try-block handler
- ERR54-CPP. Catch handlers should order their parameter types from most derived to least derived
- ERR55-CPP. Honor exception specifications
- ERR56-CPP. Guarantee exception safety
- ERR57-CPP. Do not leak resources when handling exceptions
- ERR58-CPP. Handle all exceptions thrown before main() begins executing
- ERR59-CPP. Do not throw an exception across execution boundaries
- ERR60-CPP. Exception objects must be nothrow copy constructible
- ERR61-CPP. Catch exceptions by lvalue reference
- ERR62-CPP. Detect errors when converting a string to a number
The following rules from the SEI CERT C Coding Standard also apply in C++:
- ERR30-C. Take care when reading errno
- ERR32-C. Do not rely on indeterminate values of errno
- ERR33-C. Detect and handle standard library errors
- ERR34-C. Detect errors when converting a string to a number
Information for Editors
To have a new guideline automatically listed above be sure to label it err and rule .
Risk Assessment Summary
| Rule | Severity | Likelihood | Detectable | Repairable | Priority | Level |
|---|---|---|---|---|---|---|
| ERR50-CPP | Low | Probable | No | No | P2 | L3 |
| ERR51-CPP | Low | Probable | Yes | Yes | P6 | L2 |
| ERR52-CPP | Low | Probable | Yes | No | P4 | L3 |
| ERR53-CPP | Low | Unlikely | Yes | Yes | P3 | L3 |
| ERR54-CPP | Medium | Likely | Yes | Yes | P18 | L1 |
| ERR55-CPP | Low | Likely | No | Yes | P6 | L2 |
| ERR56-CPP | High | Likely | No | No | P9 | L2 |
| ERR57-CPP | Low | Probable | No | No | P2 | L3 |
| ERR58-CPP | Low | Likely | No | Yes | P6 | L2 |
| ERR59-CPP | High | Probable | No | No | P6 | L2 |
| ERR60-CPP | Low | Probable | Yes | No | P4 | L3 |
| ERR61-CPP | Low | Unlikely | Yes | No | P2 | L3 |
| ERR62-CPP | Medium | Unlikely | Yes | No | P4 | L3 |


