Handling the exception caught by catch{} and subsequently dispose the nlobjError reference.
In order for the user to be able to benefit from Scheduling APIs, the nlobjError object needs be either
(1) driven out of the execution context (scope),
(2) or made sure other way that there's no live reference to it within the context Scheduling APIs run.
Hence, for the time being here's an alternate solution, or two:
As per the first point, the try..catch clause with its content can be wrapped to a function, as the following code snippet shows:
function main() {
_localScopeFunction();
nlapiYieldScript();
}
function _localScopeFunction() {
try {
// whatever content
} catch(err) {
// error handling
}
}
You can also take advantage of an anonymous function replacing the _localScopeFunction call, see snippet:
(function() {
try {
// whatever content
} catch(err) {
// error handling
}
})();
As per the second point, you can get rid of the reference to nlobjError using the following code placed in between your try..catch clause and the Scheduling API function call:
try {throw "ignoreme";} catch(noop) {}
No comments:
Post a Comment