Skip to content

Improve exception types raised and caught #17

Closed
@Jacob-Stevens-Haas

Description

@Jacob-Stevens-Haas

See #3. There are 19 cases of except Exception and 11 of `raise Exception. Python's philosophy is to raise the most specific error possible so that exception handlers and humans have the most information possible. The way to achieve this is via:

  • narrowing all of the raise statements
  • carefully narrow the except statements, in case any are untested.

In addition, a lot of code uses the antipattern:

try:
     do something
except Exception:
    raise

which does the same thing as

do something

Out of scope for this issue but also germane is the use of internal status-passing with integer codes, rather than raising an exception.

Ref:
https://docs.python.org/3/library/exceptions.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions