redline
LowError handlingraise-bare-exception

Raises plain Exception

Raises plain Exception. Raises a plain Exception. Callers can't catch it without catching everything.

This is how the comment reads inline, under the flagged line.

Why it matters

A generic exception forces callers into except Exception, which also catches real bugs.

What to do

Raise a specific built-in (ValueError, LookupError) or your own subclass.

Examples

Flagged
raise Exception("bad input")
Better
raise ValueError("member id must be a UUID")

What it catches

It reads a pattern on each line, aware of strings and comments. Languages: Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.

Flagged

raise Exception("bad")

Left alone

raise ValueError("bad")

Research

Raising bare `Exception` in Python. Callers cannot catch this failure without catching every failure.

Turn it off or change it

In a config file for the CLI, or in the API's rules field:

{
  "rules": {
    "disable": [
      "raise-bare-exception"
    ],
    "severity": {
      "raise-bare-exception": "medium"
    }
  }
}

Read the source or report a false positive.