Details
-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:["catch"|"except"] a specific exception type.
-
Default Severity:Minor
-
Impact:Low
-
Likelihood:Low
-
Targeted languages:C#, Java, Python
-
Covered Languages:C, C++, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:20min
-
PMD:AvoidCatchingGenericException
-
Pylint:W0702, W0703
Description
A general catch block seems like an efficient way to handle multiple possible exceptions. Unfortunately, it traps all exception types, casting too broad a net, and perhaps mishandling extraordinary cases. Instead, specific exception sub-types should be caught.
Attachments
Issue Links
- is implemented by
-
CPP-1139 Rule: General "catch" clauses should not be used
-
- Closed
-
- is related to
-
CPP-2419 S1181 & S2738: Fix false positives for generic catch handlers
-
- Closed
-
-
RSPEC-5754 "SystemExit" should be re-raised
- Active
- relates to
-
RSPEC-2221 "Exception" should not be caught when not required by called methods
- Active
1.
|
C-Family | RSPEC-2825 |
|
Active | Unassigned | |
2.
|
C# | RSPEC-2826 |
|
Active | Unassigned | |
3.
|
Python: General "except" clauses should not be used | RSPEC-2849 |
|
Active | Unassigned |