Adam Cameron
throw
). And to get the object I need to then catch it.
In other languages I'd do some variation of myException = new MyException()
Am I being dense, or is there no such functionality in CFML?
I realise I can go myJavaException = createObject("java", "MyJavaException").init()
, but the testing I need to do is specific to CFML exceptions.thisOldDave
02/16/2022, 11:23 AMlucee.runtime.exp
, createObject would workAdam Cameron
rory
02/16/2022, 12:31 PMDave Merrill
02/16/2022, 1:58 PMthisOldDave
02/16/2022, 1:59 PMsknowlton
02/16/2022, 2:18 PMAdam Cameron
sknowlton
02/16/2022, 2:34 PMDavid Buck
02/17/2022, 2:35 AMfunction throwException(type) {
switch(type) {
case "application": return fileRead("");
case "database": return queryExecute("",{},{datasource=""});
case "template": return evaluate("##");
case "object": return createObject("java",".");
case "expression": return 0/0;
case "missingInclude": include "/";
case "lock": lock scope="" timeout=0 {};
}
}
sknowlton
02/17/2022, 3:04 AMAdam Cameron
David Buck
02/17/2022, 2:27 PMthrow
)". While my function does throw exceptions (what else would you do with exceptions?), they're not like the ones you get from throw
.sknowlton
02/17/2022, 2:30 PMJonas Eriksson
02/18/2022, 10:37 AMAdam Cameron
// here you go then
thisOldDave
02/18/2022, 10:50 AM