Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

Commit 4e61ca1

Browse files
author
Axel Rindle
committed
404 error is returned when no releases could be found
1 parent ce48bfe commit 4e61ca1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/check.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,22 @@ const rest = (options, callback) => {
5454
return chunks.push(chunk.toString());
5555
});
5656
res.on('end', () => {
57-
// Make sure there are no errors and try to parse the response
58-
if (res.statusCode !== 200) {
59-
return callback(new Error(chunks), null);
60-
}
57+
// parse response string into an object
6158
const response = chunks.join('');
6259
let json = null;
6360
try {
6461
json = JSON.parse(response);
6562
} catch (error) {
6663
return callback(error, null);
6764
}
68-
if (json.message) {
65+
66+
// 404 error occurs, when no releases are found
67+
if (res.statusCode === 404) {
68+
return callback(null, null);
69+
}
70+
71+
// status codes other than 200 are treated as an error
72+
else if (res.statusCode !== 200) {
6973
return callback(new Error(json.message), null);
7074
}
7175
// Compare versions

0 commit comments

Comments
 (0)