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

Print a more helpful error message when token is expired #209

Open
sajith opened this issue Jul 25, 2023 · 0 comments
Open

Print a more helpful error message when token is expired #209

sajith opened this issue Jul 25, 2023 · 0 comments
Assignees

Comments

@sajith
Copy link
Member

sajith commented Jul 25, 2023

Currently we print a noisy backtrace (pasted below) when the token is expired. This is a little too much noise for a fairly common and expected totally expected situation.

Traceback (most recent call last):
  File "fabrictestbed-extensions/tests/integration/test_hello_fabric.py", line 19, in test_fablib_hello
    fablib = FablibManager()
             ^^^^^^^^^^^^^^^
  File "fabrictestbed-extensions/fabrictestbed_extensions/fablib/fablib.py", line 792, in __init__
    self.build_slice_manager()
  File "fabrictestbed-extensions/fabrictestbed_extensions/fablib/fablib.py", line 981, in build_slice_manager
    raise e
  File "fabrictestbed-extensions/fabrictestbed_extensions/fablib/fablib.py", line 967, in build_slice_manager
    self.slice_manager = SliceManager(
                         ^^^^^^^^^^^^^
  File "fabrictestbed-extensions/venv/lib64/python3.11/site-packages/fabrictestbed/slice_manager/slice_manager.py", line 71, in __init__
    self.initialize()
  File "fabrictestbed-extensions/venv/lib64/python3.11/site-packages/fabrictestbed/slice_manager/slice_manager.py", line 80, in initialize
    self.__load_tokens()
  File "fabrictestbed-extensions/venv/lib64/python3.11/site-packages/fabrictestbed/slice_manager/slice_manager.py", line 127, in __load_tokens
    self.refresh_tokens(refresh_token=refresh_token)
  File "fabrictestbed-extensions/venv/lib64/python3.11/site-packages/fabrictestbed/slice_manager/slice_manager.py", line 164, in refresh_tokens
    raise SliceManagerException(tokens.get(CredmgrProxy.ERROR))
fabrictestbed.slice_manager.slice_manager.SliceManagerException: b'{\n    "errors": [\n        {\n            "details": "\\"invalid_token\\"\\nerror_description=\\"token not found\\"\\n",\n            "message": "Internal Server Error"\n        }\n    ],\n    "size": 1,\n    "status": 500,\n    "type": "error"\n}'

The error message contained in SliceManagerException in this specific backtrace isn't exactly friendly, because it contains a bytes representation of JSON. That "internal server error" and format of the message suggests that Credential Manager (or/and CM proxy?) did not handle the expired token well. It would be helpful if that error message is in a more usable shape.

@sajith sajith self-assigned this Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant