Skip to content

Commit

Permalink
core: attempt to catch massive error dump when getting an errow hile …
Browse files Browse the repository at this point in the history
…flashing

There is a large dump of errors sometimes when there is a connection fault while flashing the DUT via /flash on the worker. Attempt to catch it with this change to avoid large, useless crashdump in the logs

Change-type: patch
Signed-off-by: Ryan Cooke <[email protected]>
  • Loading branch information
rcooke-warwick committed Oct 4, 2024
1 parent 3a1a989 commit 920ddb2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/lib/common/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ module.exports = class Worker {
await new Promise(async (resolve, reject) => {
const req = rp.post({ uri: `${this.url}/dut/flash`, timeout: 0 });

req.catch((error) => {
this.logger.log(`client side error: `)
this.logger.log(error.message)
reject(error);
req.on('error', (error) => {
this.logger.log('Core side error when trying to send image to worker');
reject(new Error('Error while sending image to worker'));
});

req.finally(() => {
if (lastStatus !== 'done') {
reject(new Error('Unexpected end of TCP connection'));
Expand Down Expand Up @@ -191,7 +191,7 @@ module.exports = class Worker {
fs.createReadStream(imagePath),
createGzip({ level: 6 }),
req,
);
).catch(reject(new Error('Failed to flash DUT')));
});
this.logger.log('Flash completed');
},
Expand Down

0 comments on commit 920ddb2

Please sign in to comment.