Skip to content

[Feature Request]: More user-friendly error message when token is invalid/expired #95

@bernhardschaefer

Description

@bernhardschaefer

Issue checklist

  • This is a feature request/enhancement. And not a bug.
  • I searched through the GitHub issues and this feature/enhancement has not been requested before.
  • I have installed the latest version of Foundry DevTools and don't use an unsupported python version.
  • Others could also benefit from this feature or enhancement and it is not a very specific use case.

Feature use case

The error message that people receive when they have configured an invalid or expired token is not self-explanatory. Several people already asked me in the past why they don't have permission for a specific dataset anymore when in fact they had permission but an expired token, but they got misled by the error message. It would be great if foundry-dev-tools would return a custom error message such as "Could not authenticate <your-email> at <your-configured-host>. Please check if your jwt token is invalid or has expired."

Description of the Feature

This is the error message that people currently receive with an invalid token:

FoundryAPIError: Details about the Foundry API error:

------------------------------------REQUEST------------------------------------
METHOD = POST
CONTENT-TYPE = application/json
ENDPOINT = /foundry-sql-server/api/queries/execute
-----------------------------------PARAMETERS-----------------------------------
branch = master
dialect = SPARK
timeout = 600
error_code = PERMISSION_DENIED
error_name = FoundrySqlServer:NotAuthorized
error_instance_id = b1b17d38-3b9f-4d8f-9089-xxx
operations = []
------------------------------------RESPONSE------------------------------------
ERROR_NAME = FoundrySqlServer:NotAuthorized
ERROR_CODE = PERMISSION_DENIED
ERROR_INSTANCE_ID = b1b17d38-3b9f-4d8f-9089-xxx
STATUS = 403

The error message can be reproduced with the code example from the docs:

from foundry_dev_tools import FoundryContext

ctx = FoundryContext()
df = ctx.foundry_sql_server.query_foundry_sql(
    "SELECT * FROM `/Global/Foundry Training and Resources/Example Data/Aviation Ontology/airlines`",
    branch="master",
)

As mentioned, it would be great if people would instead receive an easier to interpret message.

Alternatives you considered

I use fdt info to check if authentication works. But I can imagine that not everybody uses the CLI tool. In addition, if people do not even get the idea that their issue is authentication related, they would not verify this in the first place.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions