Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

RPCManager.setHandleErrorCallback

$
0
0
Hello,

For any case were a request fails and willHandleError is not set, I'd like to change the default behaviour to log to our application console rather than display a popup warning message; something like follows.

Code:

        RPCManager.setHandleErrorCallback(new HandleErrorCallback() {

            @Override
            public void handleError(DSResponse response, DSRequest request) {
                String error = response.getDataAsString();
                logErrorToConsole(error);
            }
        });

Essentially, I do not want it to do anything different than the default behaviour does today, except log the error to our console instead of a popup warning dialog.

1) Is there anything else I should be doing in here to maintain what the default behaviour was doing?
2) The javadoc says "By default handleError() always logs a warning"; are you doing something like SC.logWarn(response.getDataAsString())?
3) Is it safe to always assume response.getDataAsString() is an error as String here? If not, how should I be handling that check.

Thanks

SmartClient Version: v9.1p_2014-11-09/Pro Deployment (built 2014-11-09)

Viewing all articles
Browse latest Browse all 4756

Trending Articles