Start a new topic

How do I interpret Android IOException to diagnose the cause of the Kinvey error thrown?

All the examples print out the raw error message. These messages are often not human readable. Is there a list of errors thrown by Kinvey methods, especially fetching and user management-related methods? We need to improve upon this:



Log.e(LOGTAG, "Error fetching updates.", e);

CSNotificationFactory.makeToast(mContext, "Error fetching updates: "+e.getMessage());

In general, documentation/reference of errors thrown in Kinvey communication/business logic and interpreting them in Android is pretty bare. Is this in the works to fix up? If so, how long?
Hey,



you'll get more information from the exception if you call the `printStackTrace()` method on it. This will dump the entire stack of the exception to the logs, where you can see more details about what the issue might be.



If there is an issue in BL, you can also open up the console, visit the BL add-on, and add/check logging statements there.



Also, if you have a specific exception that you can't figure out you can post it here and I can help explain it.
The printStackTrace() method doesn't actually print out the getDetails().getDebug() string of a KinveyJsonResponseException. Right now I'm doing this to handle BL messages in my app:



if (e.getDetails().getDebug().contains("No user found that matches key.")){

CSNotificationFactory.makeToast(mContext, "Invalid sharing key. Cannot share information.");

}



The "No user found that matches key." message comes from our Kinvey BL, and this code works for now. However, the reference documentation for these methods is pretty empty at:

http://devcenter.kinvey.com/android/reference/api/java/reference/com/kinvey/java/core/KinveyJsonResponseException.html



And none of the examples illustrate how to handle Kinvey-related or Kinvey-BL-related errors properly. The possible errors from Kinvey requests are never enumerated in the guide, which would be really helpful.
Hey,



I can expand upon the KinveyJsonResponseException documentation, but there won't be any specifics I can add it to. This class is used for all exceptions that come from Kinvey, as long as they are formatted in JSON. `Debug` is the field that contains the relevant information specific to the thrown error, whatever it may be.



if you can, please post the relevant BL code?
Basically, the code here:

http://devcenter.kinvey.com/android/guides/business-logic#ThrowingErrors

Doesn't explain how one would access the debug, error, or description fields of this error in Android. Also I think on one of the example outputs the "error" and "debug" fields may be mixed up.



Moreover, on pages like this:

http://devcenter.kinvey.com/android/guides/datastore#Fetching

Errors are merely caught like this:

public void onFailure(Throwable error) {

Log.e(TAG, "failed to fetchByFilterCriteria", error);

}

I can't find any examples that catch and gracefully handle multiple types of errors such as not having a user logged in, no internet, no permissions, etc. Are we just supposed to find out what these errors are by creating them? :D



Maybe a section on handling errors in the guide would be best?
Hey sorry for the delay-- I'm currently in the process of expanding the troubleshooting guide and will be shipping it probably tomorrow.



Hey I just pushed an update to the troubleshooting guide, can you open it up and let me know if that's what you are looking for?



http://devcenter.kinvey.com/android/guides/troubleshooting



This is exactly what I was looking for! Thanks for the update. I think this really completes a huge missing area of the guide. In Java/Android, Exceptions are pretty much flow elements, so not having info on them makes things tough.
Login or Signup to post a comment