Log exceptions instead of reraising them in QThread
This commit is contained in:
parent
bda1478039
commit
df6f0808a3
@ -6,6 +6,7 @@ import time
|
|||||||
import tempfile
|
import tempfile
|
||||||
import hashlib
|
import hashlib
|
||||||
import zlib
|
import zlib
|
||||||
|
import logging
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
import serial.tools.list_ports
|
import serial.tools.list_ports
|
||||||
@ -62,7 +63,8 @@ class QThread(QtCore.QThread):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if self.error:
|
if self.error:
|
||||||
self.error.emit(str(exc))
|
self.error.emit(str(exc))
|
||||||
raise
|
# raise here causes windows builds to just die. ¯\_(ツ)_/¯
|
||||||
|
logging.exception('Unhandled exception')
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||||
@ -273,6 +275,7 @@ class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
app = QtWidgets.QApplication(sys.argv)
|
app = QtWidgets.QApplication(sys.argv)
|
||||||
window = MainWindow(app=app)
|
window = MainWindow(app=app)
|
||||||
window.show()
|
window.show()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user