Sitelet https://github.com/yarnpkg/yarn/pull/7848
Skip to content

handle failed policy set-version - #7848

Merged
arcanis merged 3 commits into
masterfrom
fix-set-version-upon-failure
Jan 31, 2020
Merged

arcanis merged 3 commits into
masterfrom
fix-set-version-upon-failure

Conversation

@olingern

Copy link
Copy Markdown
Contributor

Summary

Right now policies set-version does not handle invalid scenarios where an invalid github token is provided or the request fails.

Test plan

Will add a test that mocks a 401 from Github's API and that the reporter correctly logs.

Comment thread src/util/request-manager.js Outdated

const server = res.caseless.get('server');

if (res.statusCode === 401 && server === "GitHub.com") {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if a constant is worth using here. Request manager is probably too generic in some ways. Would be nice to have a Github only request manager so stuff like this could be avoided. For now, I don't think this is terrible.

});
} catch (e) {
reporter.error(e.message);
return;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the event of a promise rejection, report and return early

@buildsize

buildsize Bot commented Jan 27, 2020 •

Copy link
Copy Markdown
File name Previous Size New Size Change
yarn-[version].noarch.rpm 1.18 MB 1.18 MB 66 bytes (0%)
yarn-[version].js 4.86 MB 4.86 MB 638 bytes (0%)
yarn-legacy-[version].js 5.05 MB 5.05 MB 638 bytes (0%)
yarn-v[version].tar.gz 1.19 MB 1.19 MB 984 bytes (0%)
yarn_[version]all.deb 870.08 KB 870.2 KB 128 bytes (0%)

@olingern
olingern force-pushed the fix-set-version-upon-failure branch from f9f2c53 to 208e40a Compare January 27, 2020 18:01
@arcanis
arcanis merged commit fa613f3 into master Jan 31, 2020
@arcanis

arcanis commented Jan 31, 2020

Copy link
Copy Markdown
Member

Thanks 👍

VincentBailly pushed a commit to VincentBailly/yarn that referenced this pull request Jun 10, 2020
* handle failed policy set-version

* linting

* handle instances where caseless is not defined on response
VincentBailly pushed a commit to VincentBailly/yarn that referenced this pull request Jun 10, 2020
* handle failed policy set-version

* linting

* handle instances where caseless is not defined on response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants