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

Please include the exceptionTypeName in the JsonRPCError exception message #73

Closed
thaen opened this issue Sep 24, 2014 · 1 comment
Closed

Comments

@thaen
Copy link

thaen commented Sep 24, 2014

In most exceptions I've seen, the actual Java exception class name (like "com.android.uiautomator.core.UiObjectNotFoundException") is in the jsonresult that is received in JsonRPCMethod.call but it is thrown away when the wrapper exception JsonRPCError is created. It is trivial to include and greatly increases the readability of the exception. This has worked for me:

        if "error" in jsonresult and jsonresult["error"]:
            raise JsonRPCError(jsonresult["error"]["code"],
                   (jsonresult["error"]["data"]["exceptionTypeName"] +
                ": " +
                                jsonresult["error"]["message"]))
        return jsonresult["result"]

I'll eventually get around to submitting a patch but it might be easier for something else who is more familiar with all the exceptions that can be thrown to fix it.

@xiaocong
Copy link
Owner

Thank you. I will add it.

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