diff options
| author | 2025-11-10 19:44:23 +0000 | |
|---|---|---|
| committer | 2025-11-10 19:45:42 +0000 | |
| commit | 3b5c355314e602a40081b73e8502ac34314c7d9b (patch) | |
| tree | 606085ba052746d1018d56fa0eca255adde4e387 /pydis_core/utils/function.py | |
| parent | Unignore B904 (raise-without-from-inside-except) (diff) | |
Fix B904 across project (raise-without-from-except-inside)
Diffstat (limited to 'pydis_core/utils/function.py')
| -rw-r--r-- | pydis_core/utils/function.py | 8 |
1 files changed, 4 insertions, 4 deletions
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).") |