---
source: crates/ruff_linter/src/rules/tryceratops/mod.rs
---
TRY003.py:8:15: TRY003 Avoid specifying long messages outside the exception class
   |
 6 |     a = 1
 7 |     if a == 1:
 8 |         raise CustomException("Long message")
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY003
 9 |     elif a == 2:
10 |         raise CustomException("Short")  # This is acceptable
   |

TRY003.py:34:15: TRY003 Avoid specifying long messages outside the exception class
   |
32 | def bad(a):
33 |     if a % 2 == 0:
34 |         raise BadArgCantBeEven(f"The argument '{a}' should be even")
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY003
   |

TRY003.py:39:15: TRY003 Avoid specifying long messages outside the exception class
   |
37 | def another_bad(a):
38 |     if a % 2 == 0:
39 |         raise BadArgCantBeEven(f"The argument {a} should not be odd.")
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY003
   |

TRY003.py:44:15: TRY003 Avoid specifying long messages outside the exception class
   |
42 | def and_another_bad(a):
43 |     if a % 2 == 0:
44 |         raise BadArgCantBeEven("The argument `a` should not be odd.")
   |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TRY003
   |


