forked from platformio/platformio-core
Fix PyLint: Consider explicitly re-raising
This commit is contained in:
1 parent
f01cd7570c
commit
19d518fc4c
45 files changed
+136
-138
No files matched your search
@@ -28,8 +28,8 @@ def list_serial_ports(filter_hwid=False, as_objects=False):
|
||||
try:
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from serial.tools.list_ports import comports
|
||||
except ImportError:
|
||||
raise exception.GetSerialPortsError(os.name)
|
||||
except ImportError as exc:
|
||||
raise exception.GetSerialPortsError(os.name) from exc
|
||||
|
||||
if as_objects:
|
||||
return comports()
|
||||
|
||||
@@ -137,9 +137,9 @@ def new_serial_instance(options): # pylint: disable=too-many-branches
|
||||
if port is None or port == "-":
|
||||
try:
|
||||
port = miniterm.ask_for_port()
|
||||
except KeyboardInterrupt:
|
||||
except KeyboardInterrupt as exc:
|
||||
click.echo("", err=True)
|
||||
raise UserSideException("User aborted and port is not given")
|
||||
raise UserSideException("User aborted and port is not given") from exc
|
||||
else:
|
||||
if not port:
|
||||
raise UserSideException("Port is not given")
|
||||
@@ -180,6 +180,6 @@ def new_serial_instance(options): # pylint: disable=too-many-branches
|
||||
|
||||
serial_instance.open()
|
||||
except serial.SerialException as exc:
|
||||
raise UserSideException(exc)
|
||||
raise UserSideException(exc) from exc
|
||||
|
||||
return serial_instance
|
||||
Reference in new issue
Block a user