3

The canonical example of invoking a remote action shows three cases being handled: success, exception, and general failure:

// just showing the handler passed to the remote action invocation, for brevity
function(result, event){
    if (event.status) {
        // do something with result
    } else if (event.type === 'exception') {
        document.getElementById("responseErrors").innerHTML = event.message;
    } else {
        document.getElementById("responseErrors").innerHTML = event.message;
    }
}, 

Every example I've seen handles the else if and else cases identically. I can find no documentation of what values event.type may be when event.status is not true. Is this documented? Is there any reason I should not eliminate the "else if" block, and handle all failures in the same fashion (i.e., log the error)?

2

I don't usually do the else if and I use a lot of @RemoteAction -- if you haven't handled the error on the server side and returned some useful exception code than there aren't any other known (documented) event.types

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.