Skip to content

Question about TRY003 and built-in exceptions #2246

@divaltor

Description

@divaltor

Hello, thank you for great plugin! ❤️

I have a question about TRY003 rule, because now it raise an error on built-in exceptions.

len_str = 129

if len_str > 128:
  raise ValueError("String must be lower than 128 chars")

Ruff output:

TRY003 Avoid specifying long messages outside the exception class

Should it be like this? If don't, should we add some optional rule in settings for ignoring built-in exceptions for this rule or not?

Ruff version: 0.0.236

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions