From 3b5c355314e602a40081b73e8502ac34314c7d9b Mon Sep 17 00:00:00 2001 From: Joe Banks Date: Mon, 10 Nov 2025 19:44:23 +0000 Subject: Fix B904 across project (raise-without-from-except-inside) --- pydis_core/utils/function.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pydis_core/utils/function.py') diff --git a/pydis_core/utils/function.py b/pydis_core/utils/function.py index 2d2b7923..f2872207 100644 --- a/pydis_core/utils/function.py +++ b/pydis_core/utils/function.py @@ -51,16 +51,16 @@ def get_arg_value(name_or_pos: Argument, arguments: BoundArgs) -> typing.Any: try: _name, value = arg_values[arg_pos] - except IndexError: - raise ValueError(f"Argument position {arg_pos} is out of bounds.") + except IndexError as e: + raise ValueError(f"Argument position {arg_pos} is out of bounds.") from e else: return value elif isinstance(name_or_pos, str): arg_name = name_or_pos try: return arguments[arg_name] - except KeyError: - raise ValueError(f"Argument {arg_name!r} doesn't exist.") + except KeyError as e: + raise ValueError(f"Argument {arg_name!r} doesn't exist.") from e else: raise TypeError("'arg' must either be an int (positional index) or a str (keyword).") -- cgit v1.2.3