[lint] Remove redundant exception variables
Use bare raise statement when reraising the exception that occured, and remove unused exception variables. Also remove a pointless exception handler in discord.opus.
This commit is contained in:
		@@ -978,12 +978,12 @@ class Connectable(metaclass=abc.ABCMeta):
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            await voice.connect(reconnect=reconnect)
 | 
			
		||||
        except asyncio.TimeoutError as e:
 | 
			
		||||
        except asyncio.TimeoutError:
 | 
			
		||||
            try:
 | 
			
		||||
                await voice.disconnect(force=True)
 | 
			
		||||
            except Exception:
 | 
			
		||||
                # we don't care if disconnect failed because connection failed
 | 
			
		||||
                pass
 | 
			
		||||
            raise e # re-raise
 | 
			
		||||
            raise # re-raise
 | 
			
		||||
 | 
			
		||||
        return voice
 | 
			
		||||
 
 | 
			
		||||
@@ -260,15 +260,15 @@ class Command:
 | 
			
		||||
            elif isinstance(converter, converters.Converter):
 | 
			
		||||
                ret = await converter.convert(ctx, argument)
 | 
			
		||||
                return ret
 | 
			
		||||
        except CommandError as e:
 | 
			
		||||
            raise e
 | 
			
		||||
        except CommandError:
 | 
			
		||||
            raise
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            raise ConversionError(converter, e) from e
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            return converter(argument)
 | 
			
		||||
        except CommandError as e:
 | 
			
		||||
            raise e
 | 
			
		||||
        except CommandError:
 | 
			
		||||
            raise
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            try:
 | 
			
		||||
                name = converter.__name__
 | 
			
		||||
@@ -363,7 +363,7 @@ class Command:
 | 
			
		||||
            argument = quoted_word(view)
 | 
			
		||||
            try:
 | 
			
		||||
                value = await self.do_conversion(ctx, converter, argument, param)
 | 
			
		||||
            except CommandError as e:
 | 
			
		||||
            except CommandError:
 | 
			
		||||
                if not result:
 | 
			
		||||
                    if required:
 | 
			
		||||
                        raise
 | 
			
		||||
 
 | 
			
		||||
@@ -248,7 +248,7 @@ class HTTPClient:
 | 
			
		||||
            self._token(old_token, bot=old_bot)
 | 
			
		||||
            if e.response.status == 401:
 | 
			
		||||
                raise LoginFailure('Improper token has been passed.') from e
 | 
			
		||||
            raise e
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
        return data
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -81,10 +81,7 @@ def libopus_loader(name):
 | 
			
		||||
 | 
			
		||||
    # register the functions...
 | 
			
		||||
    for item in exported_functions:
 | 
			
		||||
        try:
 | 
			
		||||
            func = getattr(lib, item[0])
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            raise e
 | 
			
		||||
        func = getattr(lib, item[0])
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            if item[1]:
 | 
			
		||||
@@ -110,7 +107,7 @@ try:
 | 
			
		||||
        _lib = libopus_loader(_filename)
 | 
			
		||||
    else:
 | 
			
		||||
        _lib = libopus_loader(ctypes.util.find_library('opus'))
 | 
			
		||||
except Exception as e:
 | 
			
		||||
except Exception:
 | 
			
		||||
    _lib = None
 | 
			
		||||
 | 
			
		||||
def load_opus(name):
 | 
			
		||||
 
 | 
			
		||||
@@ -142,9 +142,9 @@ class VoiceClient:
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
            await asyncio.wait_for(self._handshake_complete.wait(), timeout=self.timeout, loop=self.loop)
 | 
			
		||||
        except asyncio.TimeoutError as e:
 | 
			
		||||
        except asyncio.TimeoutError:
 | 
			
		||||
            await self.terminate_handshake(remove=True)
 | 
			
		||||
            raise e
 | 
			
		||||
            raise
 | 
			
		||||
 | 
			
		||||
        log.info('Voice handshake complete. Endpoint found %s (IP: %s)', self.endpoint, self.endpoint_ip)
 | 
			
		||||
 | 
			
		||||
@@ -232,7 +232,7 @@ class VoiceClient:
 | 
			
		||||
 | 
			
		||||
                if not reconnect:
 | 
			
		||||
                    await self.disconnect()
 | 
			
		||||
                    raise e
 | 
			
		||||
                    raise
 | 
			
		||||
 | 
			
		||||
                retry = backoff.delay()
 | 
			
		||||
                log.exception('Disconnected from voice... Reconnecting in %.2fs.', retry)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user