forked from MapComplete/MapComplete
Add robustness to download script
This commit is contained in:
parent
7101baf13b
commit
703b66195f
1 changed files with 28 additions and 22 deletions
|
@ -20,6 +20,9 @@ export default class ScriptUtils {
|
|||
|
||||
public static DownloadJSON(url): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
|
||||
|
||||
https.get(url, (res) => {
|
||||
const parts: string[] = []
|
||||
res.setEncoding('utf8');
|
||||
|
@ -37,6 +40,9 @@ export default class ScriptUtils {
|
|||
}
|
||||
});
|
||||
})
|
||||
} catch (e) {
|
||||
reject(e)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue