diff --git a/src/gui/PythonBridge/Privates/EventHandlers.qml b/src/gui/PythonBridge/Privates/EventHandlers.qml index 86faa51f..46124d86 100644 --- a/src/gui/PythonBridge/Privates/EventHandlers.qml +++ b/src/gui/PythonBridge/Privates/EventHandlers.qml @@ -29,25 +29,11 @@ QtObject { if (type === "CancelledError") return - if (onError) { - onError(type, args, error, traceback) - return - } + onError ? + onError(type, args, error, traceback, uuid) : + utils.showError(type, traceback, uuid) - console.error(`python: ${uuid}\n${traceback}`) - - 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, traceback }, - ) + return } if (onSuccess) onSuccess(result) diff --git a/src/gui/Utils.qml b/src/gui/Utils.qml index ad47f28e..cba175d1 100644 --- a/src/gui/Utils.qml +++ b/src/gui/Utils.qml @@ -58,6 +58,25 @@ QtObject { } + function showError(type, traceback, sourceIndication="") { + console.error(`python: ${sourceIndication}\n${traceback}`) + + if (window.hideErrorTypes.has(type)) { + console.warn( + "Not showing GUI popup for error type " + type + + "due to user choice" + ) + return + } + + utils.makePopup( + "Popups/UnexpectedErrorPopup.qml", + window, + { errorType: type, traceback }, + ) + } + + function sum(array) { if (array.length < 1) return 0 return array.reduce((a, b) => (isNaN(a) ? 0 : a) + (isNaN(b) ? 0 : b))