mirror of
https://github.com/marcelstoer/nodemcu-pyflasher.git
synced 2025-04-19 12:57:17 +00:00
Add try/catch around opening serial port and dump exception to console
Fixes #8
This commit is contained in:
parent
a233e6f3f3
commit
9d1b526689
10
Main.py
10
Main.py
@ -8,6 +8,7 @@ import esptool
|
||||
import threading
|
||||
import json
|
||||
import images as images
|
||||
from serial import SerialException
|
||||
from serial.tools import list_ports
|
||||
from esptool import ESPROM
|
||||
from argparse import Namespace
|
||||
@ -57,7 +58,11 @@ class FlashingThread(threading.Thread):
|
||||
self._config = config
|
||||
|
||||
def run(self):
|
||||
esp = ESPROM(port=self._config.port)
|
||||
try:
|
||||
esp = ESPROM(port=self._config.port)
|
||||
except SerialException as e:
|
||||
self._parent.report_error(e.strerror)
|
||||
raise e
|
||||
args = Namespace()
|
||||
args.flash_size = "detect"
|
||||
args.flash_mode = self._config.mode
|
||||
@ -318,6 +323,9 @@ class NodeMcuFlasher(wx.Frame):
|
||||
about.ShowModal()
|
||||
about.Destroy()
|
||||
|
||||
def report_error(self, message):
|
||||
self.console_ctrl.SetValue(message)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user