Files
codeql/csharp/ql/src/Bad Practices/EmptyCatchBlock.ql
2019-01-02 12:59:07 +01:00

22 lines
527 B
Plaintext

/**
* @name Poor error handling: empty catch block
* @description Finds catch clauses with an empty block
* @kind problem
* @problem.severity recommendation
* @precision very-high
* @id cs/empty-catch-block
* @tags reliability
* readability
* exceptions
* external/cwe/cwe-390
* external/cwe/cwe-391
*/
import csharp
from CatchClause cc
where
cc.getBlock().isEmpty() and
not exists(CommentBlock cb | cb.getParent() = cc.getBlock())
select cc, "Poor error handling: empty catch block."