Errors are handled by testing @@ERROR instead of TRY ... CATCH

tx0/sql:error-variable-checkstrictwarningreliability/error-handlingdepth fastmaintainability

What it finds

Checking @@ERROR after each statement handles errors only where the check is written, and the value is reset by the next statement, including the IF that tests it. TRY ... CATCH handles every error of a block.

From the rule's source, error_variable_check.rs.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/sql:error-variable-check" = "warning"

To keep one finding, suppress it with a reason: tx0 suppress ID --reason "..." writes the comment for it.

tx0 explain tx0/sql:error-variable-check shows the same in the terminal. Found a false positive? Report it.