GUI popup for uncaught asyncio loop exceptions

This commit is contained in:
miruka
2019-12-26 10:05:01 -04:00
parent 511681ae4d
commit f977d9acf2
5 changed files with 47 additions and 8 deletions

View File

@@ -16,12 +16,12 @@ BoxPopup {
property string errorType
property var errorArguments: []
property string message: ""
property string traceback: ""
HScrollableTextArea {
text: traceback || qsTr("No traceback available")
text: [message, traceback].join("\n\n") || qsTr("No info available")
area.readOnly: true
Layout.fillWidth: true

View File

@@ -47,7 +47,7 @@ QtObject {
utils.makePopup(
"Popups/UnexpectedErrorPopup.qml",
window,
{ errorType: type, errorArguments: args, traceback },
{ errorType: type, traceback },
)
}
@@ -55,6 +55,25 @@ QtObject {
}
function onLoopException(message, error, traceback) {
// No need to log these here, the asyncio exception handler does it
const type = py.getattr(py.getattr(error, "__class__"), "__name__")
if (window.hideErrorTypes.has(type)) {
console.warn(
"Not showing error popup for this type due to user choice"
)
return
}
utils.makePopup(
"Popups/UnexpectedErrorPopup.qml",
window,
{ errorType: type, message, traceback },
)
}
function onModelUpdated(syncId, data, serializedSyncId) {
if (serializedSyncId === "Account" || serializedSyncId[0] === "Room") {
py.callCoro("get_flat_mainpane_data", [], data => {