Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

[#6712](https://github.com/yarnpkg/yarn/pull/6712) - [**Maël Nison**](https://twitter.com/arcanis)

- Properly reports the error codes when the npm registry throws 500's

[#6817](https://github.com/yarnpkg/yarn/pull/6817) - [**Maël Nison**](https://twitter.com/arcanis)

## 1.12.3

**Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal.
Expand Down
15 changes: 13 additions & 2 deletions src/util/request-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,19 @@ export default class RequestManager {
req.on('data', queue.stillActive.bind(queue));
}

if (params.process) {
params.process(req, resolve, reject);
const process = params.process;
if (process) {
req.on('response', res => {
if (res.statusCode >= 200 && res.statusCode < 300) {
return;
}

const description = `${res.statusCode} ${http.STATUS_CODES[res.statusCode]}`;
reject(new ResponseError(this.reporter.lang('requestFailed', description), res.statusCode));

req.abort();
});
process(req, resolve, reject);
}
}

Expand Down