Forum Discussion
Philip_Baird
11 years agoCommunity Expert
Hi Paul you are correct in this is a limitation in that Exceptions can only be caught cross Script Unit if the function is at Script Unit level
For example, if Unit1 contains
function scriptUnitLevel() {
// This exception can be caught
throw "Exception";
}
var exObject = (function(){
return {
objectLevel: function() {
// This exception cannot be caught
throw "Exception";
}
};
})();
then only the Exception thrown in the function scriptUnitLevel() can be caught in another Script Unit.
The work around I use is to have the object functions return Exceptions instead of throwing them and performing type checks on the caller to determine if an Exception was thrown.
I briefly outline my approach here
Related Content
- 4 years ago
Recent Discussions
- 3 days ago
- 4 days ago