Skip to content

Commit

Permalink
fix(electron): handle error events on the response stream during deli…
Browse files Browse the repository at this point in the history
…very
  • Loading branch information
yousif-bugsnag committed Oct 13, 2023
1 parent 775699d commit 4114261
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- (electron) Fix startup crash when using Electron v26+ on Linux [#2022](https://github.com/bugsnag/bugsnag-js/pull/2022)

- (electron) Fix unhandled response errors from Electron net [#2025](https://github.com/bugsnag/bugsnag-js/pull/2025)

## 7.22.0 (2023-09-13)

### Changes
Expand Down
8 changes: 8 additions & 0 deletions packages/delivery-electron/delivery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ const delivery = (client, filestore, net, app) => {

const req = net.request(opts, response => {
req.removeListener('error', errorHandler)

// in some cases (e.g. proxy authentication errors) Electron net
// will emit an error event on the response stream
response.on('error', (err) => {
err.isRetryable = isRetryable(response.statusCode)
cb(err)
})

if (isOk(response)) {
cb(null)
} else {
Expand Down

0 comments on commit 4114261

Please sign in to comment.