var scpt = new MacOS.OSA(MacOS.OSA.AppleScript);
try
{ scpt.compile( 'AppleScript compile-time error' );
}
catch(e) { MacOS.message( 'I never see this...' ) }
finally { MacOS.message( '... or this either.' ) }
var scpt = new MacOS.OSA(MacOS.OSA.AppleScript);
try
{ scpt.compile( '1 / 0' ); //-> compiles
scpt.execute(); //-> divide by 0 error
}
catch(e) { MacOS.message( 'I never see this...' ) }
finally { MacOS.message( '... or this either.' ) }
In addition to the ability to trap such errors, I'd like to request
that errors with MacOS.OSA compile() and execute() throw more
information as a part of the exception:
try
{ scpt.compile( '...' );
}
catch( e )
{ e.rangeOffsets; //-> [x, y], starting and ending offsets in the
// source code where parser encountered an error
// if getting the ending offset isn't easily implementable for
// some reason, just the starting offset would be nice:
//
e.sourceOffset;
}
{ Arthur J. Knapp;
<mailto:arthur@...>;
What...? Oh...!
}