QML Utils.showError() function
This commit is contained in:
parent
de729e42d9
commit
7fd41f3eb4
|
@ -29,27 +29,13 @@ QtObject {
|
|||
|
||||
if (type === "CancelledError") return
|
||||
|
||||
if (onError) {
|
||||
onError(type, args, error, traceback)
|
||||
onError ?
|
||||
onError(type, args, error, traceback, uuid) :
|
||||
utils.showError(type, traceback, uuid)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
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 },
|
||||
)
|
||||
}
|
||||
|
||||
if (onSuccess) onSuccess(result)
|
||||
}
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue
Block a user