---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:30:5
   |
29 | try:
30 |     raise # [misplaced-bare-raise]
   |     ^^^^^
31 | except Exception:
32 |     pass
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:36:9
   |
34 | def f():
35 |     try:
36 |         raise # [misplaced-bare-raise]
   |         ^^^^^
37 |     except Exception:
38 |         pass
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:41:5
   |
40 | def g():
41 |     raise # [misplaced-bare-raise]
   |     ^^^^^
42 |
43 | def h():
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:47:17
   |
45 |         if True:
46 |             def i():
47 |                 raise # [misplaced-bare-raise]
   |                 ^^^^^
48 |     except Exception:
49 |         pass
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:50:5
   |
48 |     except Exception:
49 |         pass
50 |     raise # [misplaced-bare-raise]
   |     ^^^^^
51 |
52 | raise # [misplaced-bare-raise]
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:52:1
   |
50 |     raise # [misplaced-bare-raise]
51 |
52 | raise # [misplaced-bare-raise]
   | ^^^^^
53 |
54 | try:
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:58:9
   |
56 | except:
57 |     def i():
58 |         raise # [misplaced-bare-raise]
   |         ^^^^^
59 |
60 | try:
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:64:9
   |
62 | except:
63 |     class C:
64 |         raise # [misplaced-bare-raise]
   |         ^^^^^
65 |
66 | try:
   |

PLE0704 Bare `raise` statement is not inside an exception handler
  --> misplaced_bare_raise.py:71:5
   |
69 |     pass
70 | finally:
71 |     raise # [misplaced-bare-raise]
   |     ^^^^^
   |
