Add robustness to download script

This commit is contained in:
Pieter Vander Vennet 2021-05-14 17:37:21 +02:00
parent 7101baf13b
commit 703b66195f

View file

@ -20,6 +20,9 @@ export default class ScriptUtils {
public static DownloadJSON(url): Promise<any> { public static DownloadJSON(url): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try {
https.get(url, (res) => { https.get(url, (res) => {
const parts: string[] = [] const parts: string[] = []
res.setEncoding('utf8'); res.setEncoding('utf8');
@ -37,6 +40,9 @@ export default class ScriptUtils {
} }
}); });
}) })
} catch (e) {
reject(e)
}
}) })
} }