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 | |
| parent | Unignore B904 (raise-without-from-inside-except) (diff) | |
Fix B904 across project (raise-without-from-except-inside)
Diffstat (limited to 'pydis_core/utils')
| -rw-r--r-- | pydis_core/utils/function.py | 8 | ||||
| -rw-r--r-- | pydis_core/utils/paste_service.py | 4 |
2 files changed, 6 insertions, 6 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).") diff --git a/pydis_core/utils/paste_service.py b/pydis_core/utils/paste_service.py index 140e6cdc..26b7c7d7 100644 --- a/pydis_core/utils/paste_service.py +++ b/pydis_core/utils/paste_service.py @@ -98,8 +98,8 @@ async def send_to_paste_service( try: async with http_session.get(f"{paste_url}/api/v1/lexer") as response: response_json = await response.json() # Supported lexers are the keys. - except HTTPException: - raise PasteUploadError("Could not fetch supported lexers from selected paste_url.") + except HTTPException as e: + raise PasteUploadError("Could not fetch supported lexers from selected paste_url.") from e _lexers_supported_by_pastebin[paste_url] = list(response_json) |