server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

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

Open hprasad-tls opened this issue 1 year ago • 7 comments

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

https://github.com/tableau/server-client-python/blob/4259316ef2e2656531b0c65c71d043708b37b4a9/tableauserverclient/server/endpoint/endpoint.py#L173

hprasad-tls avatar Sep 22 '24 07:09 hprasad-tls

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

jorwoods avatar Sep 22 '24 21:09 jorwoods

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

hprasad-tls avatar Sep 23 '24 10:09 hprasad-tls

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

jorwoods avatar Sep 23 '24 10:09 jorwoods

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

hprasad-tls avatar Sep 23 '24 10:09 hprasad-tls

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

jorwoods avatar Sep 23 '24 10:09 jorwoods

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

hprasad-tls avatar Sep 23 '24 10:09 hprasad-tls

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

hprasad-tls avatar Sep 23 '24 10:09 hprasad-tls