Skip to content

Commit

Permalink
handle response errors when delivering minidumps
Browse files Browse the repository at this point in the history
  • Loading branch information
yousif-bugsnag committed Oct 23, 2023
1 parent 74ebfda commit f8550dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/plugin-electron-deliver-minidumps/send-minidump.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {} })
})
}

Expand All @@ -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) => {} })
})
}

Expand All @@ -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) => {} })
})
}

Expand All @@ -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) => {} })
})
}

Expand Down

0 comments on commit f8550dd

Please sign in to comment.