-
Notifications
You must be signed in to change notification settings - Fork 346
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
Improve reporting auth errors #6639
Conversation
5d457ce
to
7c8704b
Compare
c1e889f
to
0f51f3a
Compare
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.
On the whole, good.
BUT is it a configuration error if the external auth provider fails? Use a more descriptive name. What about ExternalAuthProviderError or something like that?
Some other feedback inline.
expect(auth.serverEndpoint).toBe('https://my-server.com/') | ||
|
||
expect(auth.credentials).toBe(undefined) | ||
expect(auth.error.message).toContain('Unexpected end of JSON input') |
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.
This isn't working on Windows. In cmd, echo
with no arguments tells you whether echoing is on or off (and you can echo on
, echo off
to do some stdin redirection.)
In Windows to echo nothing, use echo.
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.
Fixed.
expect(auth.serverEndpoint).toBe('https://my-server.com/') | ||
|
||
expect(auth.credentials).toBe(undefined) | ||
expect(auth.error.message).toContain('Credentials expiration cannot be se to the past date') |
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.
expect(auth.error.message).toContain('Credentials expiration cannot be se to the past date') | |
expect(auth.error.message).toContain('Credentials expiration cannot be set to a date in the past') |
const expireInMs = expirationMs - Date.now() | ||
if (expireInMs < 0) { | ||
throw new Error( | ||
'Credentials expiration cannot be se to the past date: ' + |
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.
'Credentials expiration cannot be se to the past date: ' + | |
'Credentials expiration cannot be set to a date in the past: ' + |
const expireInMs = expirationMs - Date.now() | ||
if (expireInMs < 0) { |
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.
This may be more direct.
const expireInMs = expirationMs - Date.now() | |
if (expireInMs < 0) { | |
if (expirationMs < Date.now()) { |
We cannot be sure it's external provider error. That might be showing some structural problem. |
048060c
to
bba0195
Compare
bba0195
to
0eb8453
Compare
This reverts commit 1c16f35.
This reverts commit 1c16f35.
This reverts commit 1c16f35 ## Test plan Initial behaviour is restored. See [#inc-365-jetbrains-and-vscode-auth-errors](https://sourcegraph.slack.com/archives/C089N0XTC0P) This revert will be part of a series of reverts, we will validate that the intended behaviour is restored. <!-- Required. See https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles. -->
Fixes https://linear.app/sourcegraph/issue/CODY-4648
Changes
This PR improves error reporting if auth configuration is broken.
Test plan
commandLine
changeecho
toechox
and save a config.