-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle failed policy set-version #7848
Conversation
src/util/request-manager.js
Outdated
@@ -428,6 +433,13 @@ export default class RequestManager { | |||
} | |||
} | |||
|
|||
const server = res.caseless.get('server'); | |||
|
|||
if (res.statusCode === 401 && server === "GitHub.com") { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
|
f9f2c53
to
208e40a
Compare
Thanks 👍 |
* handle failed policy set-version * linting * handle instances where caseless is not defined on response
* handle failed policy set-version * linting * handle instances where caseless is not defined on response
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.