Skip to content

Commit

Permalink
fix(updater): handle errors on responses in differential download (#7542
Browse files Browse the repository at this point in the history
)

The error will just be thrown by the net module if there's no error handler. Fixes #2398
  • Loading branch information
ganthern committed Apr 13, 2023
1 parent a4888ac commit 9123e31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-ladybugs-rhyme.md
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

fix: handle errors on responses in differential download (#2398)
Expand Up @@ -228,6 +228,10 @@ export abstract class DifferentialDownloader {
}

const request = this.httpExecutor.createRequest(requestOptions, response => {
response.on("error", reject)
response.on("abort", () => {
reject(new Error("response has been aborted by the server"))
})
// Electron net handles redirects automatically, our NodeJS test server doesn't use redirects - so, we don't check 3xx codes.
if (response.statusCode >= 400) {
reject(createHttpError(response))
Expand Down

0 comments on commit 9123e31

Please sign in to comment.