Added error/stack sending, question simplifying bugfix

This commit is contained in:
MrFry 2019-10-07 11:00:26 +02:00
parent a445512234
commit e53ca9d87c

51
main.js
View file

@ -189,15 +189,37 @@ class StringUtils {
if (!value) { return } if (!value) { return }
let mods = [ let mods = [
this.RemoveSpecialChars, this.RemoveSpecialChars.bind(this),
this.RemoveUnnecesarySpaces, this.RemoveUnnecesarySpaces.bind(this),
this.QuestionPreProcessor, this.QuestionPreProcessor.bind(this),
this.RemoveAnswerLetters this.RemoveAnswerLetters.bind(this)
] ]
return mods.reduce((res, fn) => { const reducer = (res, fn) => {
return fn(res) return fn(res)
}, value) }
return mods.reduce(reducer, value)
}
SimplifyStack (stack) {
stack = this.SimplifyQuery(stack)
let ns = ''
let adding = true
stack.split('').forEach((c) => {
if (c === '(') {
adding = false
}
if (adding) {
ns += c
}
if (c === ')') {
adding = true
}
})
return ns
} }
} }
@ -834,10 +856,25 @@ function Main () {
m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!', m: 'Fatál error. Check console (f12). Kattints az üzenetre az összes kérdés/válaszért manuális kereséshez!',
isSimple: true isSimple: true
}, undefined, function () { }, undefined, function () {
openInTab(serverAdress + 'lred', { let path = 'lred'
try {
if (e.message || e.stack) {
path += '?'
}
if (e.message) {
path += 'msg:' + SUtils.SimplifyQuery(e.message) + '&'
}
if (e.stack) {
path += 'stack:' + SUtils.SimplifyStack(e.stack)
}
} catch (e) {
Exception(e, 'error at setting error stack/msg link')
}
openInTab(serverAdress + path, {
active: true active: true
}) })
}) })
Exception(e, 'script error at main:') Exception(e, 'script error at main:')
} }
if (url.includes('eduplayer')) { AddVideoHotkeys(url) } // adding video hotkeys if (url.includes('eduplayer')) { AddVideoHotkeys(url) } // adding video hotkeys