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

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

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

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