From 2fa5aa2037616b0cfd61ac67f6d145e6da12723a 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 ++++---- pydis_core/utils/paste_service.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'pydis_core/utils') 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) -- cgit v1.2.3