Service call error call in a function

I would like to know what is the cause of this kind of error :

When you see that error it is because you have a javaScript error in a service listener within your code.

In your code you will have something like this:

var srv = form.getServiceConfiguration('SC_theService');
srv.connectEvent("onCallFinished", function(success)
{
if(success) {
try {
//put code in here to execute when service is done
} catch(err) {
alert("SC_theService: " + err);
}
} else {
//does this do anything?
}
});

Now what I pasted above may be different, as I have added a try/catch. This is extremely helpful when debugging issues with onCallFinished handlers. This alert will show me the actual javaScript error.

The other approach that you can take is to add "debugger;" (this creates a breakpoint) to your onCallFinishedHandlers, enable the browser developer tools and then step through the code.

thanks you Christopher Dawes