You need to sign in to do that
Don't have an account?
Big Ears
Error handling when a trigger calls a number of classes
Dear all,
Just a quick question.
I have a trigger that calls a series of methods within Apex classes when a contract is activated. Currently, if one of those methods causes an exception, the trigger assumes it is unhandled, even if there is error handling within the apex class. Is there a way of passing the error handling back "up" to the trigger, so that the UI doesn't show an ugly exception page?
With thanks,
Andy
public class testExpt
{
public class GeneralException extends Exception
{
}
public void exptTesting(Master_Object__c[] testObjectArray)
{
for (Master_Object__c t: testObjectArray)
{
if(t.TestNumber__c < 25.00)
{
throw new GeneralException('This is bad number');
}
}
}
}
trigger TestOnMasterObject on Master_Object__c (before insert) {
testExpt testCls = new testExpt();
testCls.exptTesting(system.trigger.new);
}