qubole / qds-sdk-java

A Java library that provides the tools you need to authenticate with, and use the Qubole Data Service API.

Home Page:https://api.qubole.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not getting proper response body in case of error.

prat2065 opened this issue · comments

If I hit qubole API to create schedule directly with an invalid value of frequency say -1, I get the following error message : "Validation failed: Frequency must be an integer greater than 0".
But while using the qubole sdk,we get the response as javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ClientErrorException: HTTP 422 Unprocessable Entity

Hence somewhere you have lost the exact error message given by qubole API .
422 status code can be given by qubole for multiple reasons.
It is happening because in ErrorResponseFilter,you are consuming the error message from input stream and the user will not be able to consume it later.Hence,we should stick the message back to the response context.

I would more generalize the issue:
In case if we get any error from the API through SDK (in my case SparkCommandBuilder), the only entity we are able to handle is Throwable that contains the mentioned above rather generic description.

Thus, there is no possibility to get command ID assigned to the request and trace the cause later.