split gunzip and untar errors

This commit is contained in:
Stephen Birarda 2016-04-11 17:36:14 -07:00
parent 7dbdc9ca0a
commit db4f1a8acb

View file

@ -571,7 +571,7 @@ function maybeInstallDefaultContentSet(onComplete) {
} }
}); });
req.pipe(zlib.createGunzip()).pipe(tar.extract(getRootHifiDataDirectory())).on('error', function(){ function extractError(err) {
console.log("Aborting request because gunzip/untar failed"); console.log("Aborting request because gunzip/untar failed");
aborted = true; aborted = true;
req.abort(); req.abort();
@ -580,7 +580,12 @@ function maybeInstallDefaultContentSet(onComplete) {
sendStateUpdate('error', { sendStateUpdate('error', {
message: "Error installing resources." message: "Error installing resources."
}); });
}).on('finish', function(){ }
var gunzip = zlib.createGunzip();
gunzip.on('error', extractError);
req.pipe(gunzip).pipe(tar.extract(getRootHifiDataDirectory())).on('error', extractError).on('finish', function(){
// response and decompression complete, return // response and decompression complete, return
console.log("Done", arguments); console.log("Done", arguments);
sendStateUpdate('complete'); sendStateUpdate('complete');