---
source: crates/ruff_linter/src/rules/tryceratops/mod.rs
---
TRY301 Abstract `raise` to an inner function
  --> TRY301.py:14:13
   |
12 |         a = process()
13 |         if not a:
14 |             raise MyException(a)
   |             ^^^^^^^^^^^^^^^^^^^^
15 |
16 |         raise MyException(a)
   |

TRY301 Abstract `raise` to an inner function
  --> TRY301.py:16:9
   |
14 |             raise MyException(a)
15 |
16 |         raise MyException(a)
   |         ^^^^^^^^^^^^^^^^^^^^
17 |
18 |         try:
   |

TRY301 Abstract `raise` to an inner function
  --> TRY301.py:21:17
   |
19 |             b = process()
20 |             if not b:
21 |                 raise MyException(b)
   |                 ^^^^^^^^^^^^^^^^^^^^
22 |         except Exception:
23 |             logger.exception("something failed")
   |

TRY301 Abstract `raise` to an inner function
  --> TRY301.py:32:13
   |
30 |         a = process()
31 |         if not a:
32 |             raise MyException(a)
   |             ^^^^^^^^^^^^^^^^^^^^
33 |
34 |         raise MyException(a)
   |

TRY301 Abstract `raise` to an inner function
  --> TRY301.py:34:9
   |
32 |             raise MyException(a)
33 |
34 |         raise MyException(a)
   |         ^^^^^^^^^^^^^^^^^^^^
35 |
36 |         try:
   |

TRY301 Abstract `raise` to an inner function
  --> TRY301.py:39:17
   |
37 |             b = process()
38 |             if not b:
39 |                 raise MyException(b)
   |                 ^^^^^^^^^^^^^^^^^^^^
40 |         except* Exception:
41 |             logger.exception("something failed")
   |
