Skip to content

Commit 8303023

Browse files
Apply flake8-bugbear rule
B904 Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
1 parent aa42671 commit 8303023

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/installer/scripts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ def _get_launcher_data(self, kind: "LauncherKind") -> Optional[bytes]:
126126
key = (self.section, kind)
127127
try:
128128
name = _ALLOWED_LAUNCHERS[key]
129-
except KeyError:
129+
except KeyError as exc:
130130
error = f"{key!r} not in {sorted(_ALLOWED_LAUNCHERS)!r}"
131-
raise InvalidScript(error)
131+
raise InvalidScript(error) from exc
132132
return read_binary(_scripts, name)
133133

134134
def _get_alternate_executable(self, executable: str, kind: "LauncherKind") -> str:

0 commit comments

Comments
 (0)