diff --git a/packages/plugin-electron-deliver-minidumps/send-minidump.js b/packages/plugin-electron-deliver-minidumps/send-minidump.js index 6b224db605..a36c5fbde3 100644 --- a/packages/plugin-electron-deliver-minidumps/send-minidump.js +++ b/packages/plugin-electron-deliver-minidumps/send-minidump.js @@ -8,6 +8,8 @@ module.exports = (net, client) => { const send = (opts, formData) => { return new Promise((resolve, reject) => { const req = net.request(opts, response => { + response.on('error', reject) + if (isOk(response)) { resolve() } else { diff --git a/packages/plugin-electron-deliver-minidumps/test/send-minidump.test.ts b/packages/plugin-electron-deliver-minidumps/test/send-minidump.test.ts index edbecbb18c..828dff95b1 100644 --- a/packages/plugin-electron-deliver-minidumps/test/send-minidump.test.ts +++ b/packages/plugin-electron-deliver-minidumps/test/send-minidump.test.ts @@ -24,7 +24,7 @@ describe('electron-minidump-delivery: sendMinidump', () => { it('sends minidump successfully', async () => { const net = { request: jest.fn().mockImplementation((_, handle) => { - handle({ statusCode: 200 }) + handle({ statusCode: 200, on: (event, cb) => {} }) }) } @@ -48,7 +48,7 @@ describe('electron-minidump-delivery: sendMinidump', () => { it('marks server error as retry', async () => { const net = { request: jest.fn().mockImplementation((opts, handle) => { - handle({ statusCode: 500 }) + handle({ statusCode: 500, on: (event, cb) => {} }) }) } @@ -62,7 +62,7 @@ describe('electron-minidump-delivery: sendMinidump', () => { it('marks bad request as no-retry', async () => { const net = { request: jest.fn().mockImplementation((opts, handle) => { - handle({ statusCode: 400 }) + handle({ statusCode: 400, on: (event, cb) => {} }) }) } @@ -77,7 +77,7 @@ describe('electron-minidump-delivery: sendMinidump', () => { let minidumpFile const net = { request: jest.fn().mockImplementation((_, handle) => { - handle({ statusCode: 200 }) + handle({ statusCode: 200, on: (event, cb) => {} }) }) }