Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Exception Handling

Exception Handling

When you invoke Backend Services Android SDK methods, errors might sometimes occur. For example, if you invoke a method on a device that has no internet connection at the time, an error will occur. You can use the RequestResult object's getError() method, which returns an EverliveException instance. You can get the internal error code, the error message or re-throw it in order to catch it in a parent method.

executeAsync(new RequestResultCallbackAction<ArrayList<Activity>>() {
        @Override
        public void invoke(RequestResult<ArrayList<Activity>> requestResult) {
            if (requestResult.getSuccess()) {
                for (Activity activity : requestResult.getValue()) {
                    System.out.println(activity.toString());
                }
            } else {
                System.out.println(requestResult.getError().toString());
            }
        }
    });

All error messages from Telerik Platform will have an error code and a text part. However if a different kind of error (exception) occurs in the process of deserializing (e.g. an IOException), then the real exception is wrapped in an EverliveException. The original exception message could then be obtained through this method:

everliveException.getError().getMessage();
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.