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

Can we convert this in to ServerResponseError.from_response exception instead of NonXMLResponseError #1472

Closed
hprasad-tls opened this issue Sep 22, 2024 · 7 comments

Comments

@hprasad-tls
Copy link

It would be helpful if ServerResponseError.from_response is implemented on line 173 instead NonXMLResponseError.

raise NonXMLResponseError(server_response.content)

@jorwoods
Copy link
Contributor

Can you expand on what you're trying to do and why you think that would be helpful? ServerResponseError is for interpreting errors from a Tableau Server, and parsing that XML into a more descriptive error. If you're getting a NonXMLResponseError then a ServerResponseError.from_response would also not be able to process the content returned. If you're just trying to catch the error, you probably want to go one level up in the exception hierarchy.

from tableauserverclient.server.endpoint.exceptions import TableauError

@hprasad-tls
Copy link
Author

It's improves the readability and parsing of information, as ServerResponseError.

@jorwoods
Copy link
Contributor

The issue is if the server doesn't return XML, it can't be parsed into a ServerResponseError. Hence: NonXMLResponseError.

@hprasad-tls
Copy link
Author

but I have seen it responding xml response but data is not parsed.

@jorwoods
Copy link
Contributor

Can you post a reproducible example of what you are trying when you get the error, as well as the error message returned?

@hprasad-tls
Copy link
Author

This is happening when personal token is wrong and Server authentication failed to Sign in.

@hprasad-tls
Copy link
Author

As you can see in this, it's a XML response the exception is raised because of wrong token.
image

jorwoods added a commit to jorwoods/server-client-python that referenced this issue Sep 28, 2024
Closes tableau#1472

This makes sign in failures their own class of exceptions, while still
inheriting from NotSignedInException to not break backwards
compatability for any existing client code. This should allow users
to get out more specific exceptions more easily on what failed with
their authentication request.
jorwoods added a commit to jorwoods/server-client-python that referenced this issue Sep 28, 2024
Closes tableau#1472

This makes sign in failures their own class of exceptions, while still
inheriting from NotSignedInException to not break backwards
compatability for any existing client code. This should allow users
to get out more specific exceptions more easily on what failed with
their authentication request.
jorwoods added a commit to jorwoods/server-client-python that referenced this issue Sep 28, 2024
Closes tableau#1472

This makes sign in failures their own class of exceptions, while still
inheriting from NotSignedInException to not break backwards
compatability for any existing client code. This should allow users
to get out more specific exceptions more easily on what failed with
their authentication request.
jorwoods added a commit to jorwoods/server-client-python that referenced this issue Sep 28, 2024
Closes tableau#1472

This makes sign in failures their own class of exceptions, while still
inheriting from NotSignedInException to not break backwards
compatability for any existing client code. This should allow users
to get out more specific exceptions more easily on what failed with
their authentication request.
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

2 participants