Skip to main content

Hey!

I’m trying to write in some error handling for the updateData() function. I found in the documentation that the method returns a jQuery deferred promise object.

I am able to get it to work for the deferred.done method when there’s no error:
dd1248bd4fa0e66e15901433295167a8854cee70.png

However, it does not seem to work for the deferred.fail method when there is an error:


Am I doing something wrong, or is there a better way to implement error handling with the updateData method?

Thanks!
Kartik

Hi Kartik,

The issue is actually with Salesforce’s Javascript / Visualforce Remoting logic, which throws errors that are uncatchable from JavaScript if there is an exception thrown server-side. There’s no easy way to catch these errors other than to intercept the unsupported, Salesforce-internal JavaScript method Visualforce.remoting.Util.error — there’s no other way that we’ve found to intercept these JavaScript-remoting errors client-side before they are thrown as Javascript Errors.


Intercepting the Visualforce.remoting.Util.error method did the trick. Thanks!