Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Add 'raise X from e' in more places #9318

@ShadowJonathan

Description

@ShadowJonathan

While working on #9279 i noticed that a lot of exceptions raised often don't re-use the exception when raising;

# this
try:
  # yada
except Exception:
  raise CustomException()

# instead of this
try:
  # yada daba doo
except Exception as e:
  raise CustomException() from e

The latter adds more context and a longer and more detailed traceback to look at.

The request;

  • Add more of these in a lot of places (either raise X from e, or putting them into twisted Failure objects that're thrown somewhere)
    • If it won't be added to the re-raised exception, put down a message why in the comment (sensitive information, etc.)

- (Maybe) Make it a coding policy/find a linter to enforce raised exception usage, unless explicitly suppressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions