Improve error handling during launch (#21)

If anything happens to the forked process, the main should now pick up on it and alert the user.
Should no longer get 'stuck at 100%' issues when the forked process fails, for whatever reason.
This commit is contained in:
Daniel Scalzi
2019-01-20 06:55:13 -05:00
parent cb12c0786e
commit 8c0bf8faac
2 changed files with 40 additions and 36 deletions

View File

@@ -534,7 +534,12 @@ exports.pullRemote = function(){
const distroDest = path.join(ConfigManager.getLauncherDirectory(), 'distribution.json')
request(opts, (error, resp, body) => {
if(!error){
data = DistroIndex.fromJSON(JSON.parse(body))
try {
data = DistroIndex.fromJSON(JSON.parse(body))
} catch (e) {
reject(e)
}
fs.writeFile(distroDest, body, 'utf-8', (err) => {
if(!err){