Skip to content

Commit

Permalink
fix: Handle promise resolution/rejection (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
hisco committed Dec 7, 2023
1 parent 4e09a73 commit fb5ed3a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Expand Up @@ -642,6 +642,15 @@
"doc",
"test"
]
},
{
"login": "hisco",
"name": "Eyal Hisco",
"avatar_url": "https://avatars.githubusercontent.com/u/39222286?v=4",
"profile": "https://api.github.com/users/hisco",
"contributions": [
"bug"
]
}
],
"commitConvention": "angular"
Expand Down
22 changes: 13 additions & 9 deletions src/http/node/index.js
Expand Up @@ -36,15 +36,19 @@ export async function request({
},
(err, res) => {
if (err) return reject(err)
const iter = fromNodeStream(res)
resolve({
url: res.url,
method: res.method,
statusCode: res.statusCode,
statusMessage: res.statusMessage,
body: iter,
headers: res.headers,
})
try {
const iter = fromNodeStream(res)
resolve({
url: res.url,
method: res.method,
statusCode: res.statusCode,
statusMessage: res.statusMessage,
body: iter,
headers: res.headers,
})
} catch (e) {
reject(e)
}
}
)
})
Expand Down
3 changes: 3 additions & 0 deletions src/wire/parseUploadPackResponse.js
Expand Up @@ -32,6 +32,9 @@ export async function parseUploadPackResponse(stream) {
} else if (line.startsWith('NAK')) {
nak = true
done = true
} else {
done = true
nak = true
}
if (done) {
resolve({ shallows, unshallows, acks, nak, packfile, progress })
Expand Down

0 comments on commit fb5ed3a

Please sign in to comment.