From 41142613433fea1b06ba342decfe88d24733d976 Mon Sep 17 00:00:00 2001 From: Yousif Ahmed Date: Fri, 13 Oct 2023 12:20:54 +0100 Subject: [PATCH] fix(electron): handle error events on the response stream during delivery --- CHANGELOG.md | 2 ++ packages/delivery-electron/delivery.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 249517aa4e..5e1cf9a244 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/delivery-electron/delivery.js b/packages/delivery-electron/delivery.js index 7216350692..138e49cf2b 100644 --- a/packages/delivery-electron/delivery.js +++ b/packages/delivery-electron/delivery.js @@ -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 {