Skip to content

Commit a2cea14

Browse files
Add try catch
1 parent 9ce0e7b commit a2cea14

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

bin/helpers/zipUpload.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,19 @@ const uploadSuits = (bsConfig, filePath, opts, obj) => {
9696
});
9797

9898
obj.zipInterval = setInterval(function () {
99-
if (r && r.req && r.req.connection) {
100-
let dispatched = r.req.connection._bytesDispatched;
101-
let percent = dispatched * 100.0 / size;
102-
obj.bar1.update(percent, {
103-
speed: ((dispatched / (Date.now() - obj.startTime)) / 125).toFixed(2) //kbits per sec
104-
});
105-
} else {
106-
logger.warn('Connection is undefined/null for zip upload request. Unable to determine progress.');
99+
try {
100+
if (r && r.req && r.req.connection) {
101+
let dispatched = r.req.connection._bytesDispatched;
102+
let percent = dispatched * 100.0 / size;
103+
obj.bar1.update(percent, {
104+
speed: ((dispatched / (Date.now() - obj.startTime)) / 125).toFixed(2) //kbits per sec
105+
});
106+
} else {
107+
logger.warn('Connection is undefined/null for zip upload request. Unable to determine progress.');
108+
}
109+
} catch (error) {
110+
logger.warn('Unable to determine progress.');
111+
logger.error(error);
107112
}
108113
}, 150);
109114

0 commit comments

Comments
 (0)