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

vdk-control-api-auth: add better error message for refresh token failure #2607

Merged
merged 1 commit into from
Aug 28, 2023

Conversation

antoniivanov
Copy link
Collaborator

In case user cannot refresh their access token currently we simply show error "KeyError: 'access_token'" with some stack trace which makes it practically impossible for the user to know what to do.

Traceback (most recent call last):
File
"/opt/conda/lib/python3.7/site-packages/vdk/internal/cli_entry.py", line
140, in vdk_main
    program_name=program_name,
File "/opt/conda/lib/python3.7/site-packages/pluggy/_hooks.py", line
433, in __call__
return self._hookexec(self.name, self._hookimpls, kwargs,
firstresult)
........
File
"/opt/conda/lib/python3.7/site-packages/vdk/plugin/control_api_auth/base_auth.py",
line 167, in __exchange_refresh_for_access_token
self.update_access_token(json_data[AuthRequestValues.ACCESS_TOKEN_KEY.value])
KeyError: 'access_token'

This changes that to explicitly raise an appropriate exception and recommend what user should do

In case user cannot refresh their access token currently we simply show
error "KeyError: 'access_token'" with some stack trace which makes it
practically impossible for the user to know what to do.

```
Traceback (most recent call last):
File
"/opt/conda/lib/python3.7/site-packages/vdk/internal/cli_entry.py", line
140, in vdk_main
    program_name=program_name,
File "/opt/conda/lib/python3.7/site-packages/pluggy/_hooks.py", line
433, in __call__
return self._hookexec(self.name, self._hookimpls, kwargs,
firstresult)
........
File
"/opt/conda/lib/python3.7/site-packages/vdk/plugin/control_api_auth/base_auth.py",
line 167, in __exchange_refresh_for_access_token
self.update_access_token(json_data[AuthRequestValues.ACCESS_TOKEN_KEY.value])
KeyError: 'access_token'

```

This changes that to explicitly raise an appropriate exception and
recommend what user should do
@antoniivanov antoniivanov merged commit 47adb89 into main Aug 28, 2023
16 checks passed
@antoniivanov antoniivanov deleted the person/aivanov/vdk-control-api-auth-error branch August 28, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants