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)?
Attribution to: Jason Clark
Possible Suggestion/Solution #1
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
Attribution to: jordan.baucke
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/1452