Commit 609b1a51 authored by Erwan BOUSSE's avatar Erwan BOUSSE
Browse files

Improve error messages

parent c186c249
Pipeline #18625 passed with stages
in 52 seconds
......@@ -121,6 +121,12 @@ function sortEventsPerPerson(events: any[]): Map<string, any[]> {
function getAllURLsFromCelcatPageAsync(url: string, then: (allICS: Map<string, string>) => void, log) {
httpGetAsync(url, (responseText: string) => {
if (isEmptyOrNull(responseText)) {
log("")
log("Impossible d'analyser le fichier ICS. Arrêt.")
log("")
return
}
let domparser: DOMParser = new DOMParser();
let parsedContent = domparser.parseFromString(responseText, 'text/html')
let options: HTMLCollection = parsedContent.getElementsByTagName("option")
......@@ -187,6 +193,10 @@ function httpGetAsync(url: string, then, log) {
then(xmlHttp.responseText)
}, log)
}
xmlHttp.onerror = (err) => {
logErr(err + "", log)
log("Si vous n'avez pas activé l'extension CORS Everywhere, le problème vient peut-être de là.")
}
}
function getPersonFromEvent(event: any): string {
......@@ -328,13 +338,17 @@ export function initPage(): void {
modeChanged()
}
function logErr(message: string, log) {
log("")
log("##### Erreur rencontrée : " + message)
log("")
}
function wrapExec(f, log) {
try {
f()
} catch (e) {
log("")
log("##### Une erreur imprévue a été rencontrée : " + e)
logErr(e, log)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment