It looks like you're new here. If you want to get involved, click one of these buttons!
KiteException
, which is not being set. As of now only code and message are being set. I guess it requires a code fix.
HTTP/1.1 500 Server error
Content-Type: application/json
{
"status": "error",
"message": "Error message",
"error_type": "GeneralException"
}
Thanks and Regards,
So long as you read the document and do it correct, you wouldn't need any Exception information
error_type
for raised exceptions. You can easily re-produce it at your end for TokenException, InputException, etc and check.@rakeshr I got the TokenException which I want to handle. As per the documentation
error_type
is not set. Onlycode
andmessage
is set.No doubt, I can check for the class throwing the exception. But then, it is going to be a work-around.
Alternatively, if the JSON exception could have been thrown (from KiteResponseHandler.java) then it would have been better.
Pasted below is my Exception handling snippet with requirements mentioned in the code comment. Also pasted is the related java files/snippets from KiteConnect library.
Sample snippet for handling KiteException Here is
TokenException.java
. I do not seeerror_type
being set.Also in
KiteException.java
And in theKiteResponseHandler.java
you can see that only code and message is thrown.As per the last code section you posted there is a 1:1 relation between the known
error_type
and the exception type it produces. If you really want you can dogetClass().getName()
and get the string name.And the value of
status
can be onlysuccess
orerror
which again you can infer by checking if it throws an exception or not.Is there a case that doesn't conform to this?
message
. As mentioned in my first post, I can definitely handle it this way, but this is a work-around and not as per documentation.The Kite Connect API is written in a generic way, the whole point of client libraries is to avoid using these raw values and consume API in the style of the language.
The javakiteconnect is an open source repository. If you don't like it then you can fork the library and make changes as you wish.
Thank you all for your inputs.
For eg.
403 - Session Expired
429 - NetworkException - Maximum allowed order modifications exceeded.