PyAPI: remove use of BaseException

BaseException was used as a catch-all in situations where it
didn't make sense and where "Exception" is more appropriate
based on Python's documentation & error checking tools,
`pylint` warns `broad-exception-caught` for e.g.

BaseException includes SystemExit, KeyboardInterrupt & GeneratorExit,
so unless the intention is to catch calls to `sys.exit(..)`,
breaking a out of a loop using Ctrl-C or generator-exit,
then it shouldn't be used.

Even then, it's preferable to catch those exceptions explicitly.
This commit is contained in:
Campbell Barton
2024-10-01 13:18:46 +10:00
parent 22cdf8da1e
commit a7ab81d927
26 changed files with 69 additions and 69 deletions

View File

@@ -219,7 +219,7 @@ def main() -> None:
try:
with open(backtrace_filepath, 'r', encoding="utf-8", errors="surrogateescape") as fh:
bactrace_data = fh.read()
except BaseException as ex:
except Exception as ex:
print("Filed to open {!r}, {:s}".format(backtrace_filepath, str(ex)))
continue