RE: Support for try-catch in CRMScript
I assume 'error' is a variable, not a keyword. So since it's inside the catch-block you should be fine to use "String error" in your code as well.
* Sverre, how will unhandled exceptions be handled?
F.instance, this script:
#setLanguageLevel 3;
throw "This is an unhandled exception outside a try-catch";
* Would it be possible to have a Trigger called "Unhandled exception in script"?
* Sverre, the 'error' parameter looks like a plain String. Would it be possible get access to a more complex object as well? Perhaps a 'errorObject', 'exception' or similar? That object-definition could look somewhat like this:
struct Exception {
String Type;
String ErrorMessage;
String ScriptIncludeName;
Integer ScriptCodeLine;
String StackTrace;
}
Imagine this scenario where it would be difficult to see where the problem comes from when the 'error' is just a string.
try {
Integer a = getCgiVariable("a").toInteger();
Integer b = getCgiVariable("b").toInteger();
Integer c = a / b;
Integer d = b / a;
Integer e = c / d;
} catch {
log(error); //Hmm, I wonder where this error occured...?
//Linenumbers in the Exception object would have been nice ;)
}