Ah! I remember now... I had worked a case previously. The issue seems to be that we can handle exception propagation with direct calls to remote functions but not through copies or references. So while this would work:
//USEUNIT UnitB
function main()
{
try {
doSomething(); // This is direct
} catch(e) {
Log.Message(e.message);
}
}
this would not:
//USEUNIT UnitB
function main()
{
try {
var fn = doSomething; // indirect
fn(); // Microsoft JScript runtime error
} catch(e) {
Log.Message(e.message);
}
}
The only workaround I could come up with at the time was to make the call to the remote function in a try/catch from within the remote unit (assuming you know where it is...) and provide callbacks to the handle the catching code.
//USEUNIT UnitB
function main()
{
var fn = doSomething;
remotecall( fn, catchfunc ); // call the function from its own unit
}
function catchfunc(e) { Log.Message(e.description); }
//UnitB
function remotecall( fn, catchfunc )
{
try {
fn();
} catch(e) {
catchfunc();
}
}
function doSomething()
{
throw new Error("doSomething");
}
Not a pretty hack.
I urge you to submit a feature request or add your vote to any existing feature request to see if the developers can get this fixed.