5

I am calling remote actions which call external services. These external services are called in synchronous manner using web services callout. Are there any best practices around how to handle exception scenarios like when services do not return any response.

3

The best practice for exception handling will be showing a toast or error message on time out and this can be captured on the callback

Since JavaScript remoting you can check for errors in the callback .

Visualforce.remoting.Manager.invokeAction(
                    '{!$RemoteAction.CallController.logCall
                    }'
                    function(result, event){
                        if (event.status) {

                        } else {
                            //validatorSLDSplugin.displayalert(event.message,'error');
                            //show a toast
                        }
                    }, 
                    {escape: false}
                );

Also you can set exception message from apex by throwing exception and then showing on front end via Toast .Also you can specify time out value

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.