Skip to content
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 error message when login fails #539

Closed
Electroid opened this issue Mar 3, 2022 · 1 comment · Fixed by #794 or #817
Closed

Improve error message when login fails #539

Electroid opened this issue Mar 3, 2022 · 1 comment · Fixed by #794 or #817
Assignees
Labels
polish Small improvements to the experience

Comments

@Electroid
Copy link
Contributor

Electroid commented Mar 3, 2022

We should improve the error message when there's a fatal error during login:

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at Response2.json (/node_modules/wrangler/wrangler-dist/cli.js:104161:21)
    at async exchangeRefreshTokenForAccessToken (/node_modules/wrangler/wrangler-dist/cli.js:133913:11)
    at async refreshToken (/node_modules/wrangler/wrangler-dist/cli.js:134131:23)
    at async loginOrRefreshIfRequired (/node_modules/wrangler/wrangler-dist/cli.js:134050:12)
    at async Object.handler (/node_modules/wrangler/wrangler-dist/cli.js:143181:24)
Did not login, quitting...
@Electroid Electroid added the polish Small improvements to the experience label Mar 3, 2022
@threepointone threepointone added this to the 2.0 milestone Apr 5, 2022
@caass
Copy link
Contributor

caass commented Apr 11, 2022

This could be because the error message being returned to us is HTML, so we should probably try parsing as HTML (or at least saying more nicely "there was an error") if JSON parsing fails

@JacobMGEvans JacobMGEvans self-assigned this Apr 12, 2022
JacobMGEvans added a commit that referenced this issue Apr 13, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 15, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 19, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 19, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 19, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 19, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 20, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 20, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 20, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 20, 2022
…r in some situations. Added a fallback if `.json` fails to parse

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
JacobMGEvans added a commit that referenced this issue Apr 20, 2022
…r in some situations. Added a fallback if `.json` fails to parse (#794)

it will attempt `.text()` then throw result. If both attempts to parse fail it will throw an `UnknownError` with a message showing where
it originated.

should resolve #539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish Small improvements to the experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants