Another post for future referencing
Adding error handling within a Trigger or database transaction
try{
}catch(DMLException e){
for (Integer i = 0; i < e.getNumDml(); i++) {
// Process exception here
System.debug(e.getDmlMessage(i));
LineItemList [i].adderror(e.getDmlMessage(i));
}
}
Adding error handling within a method
try{
//work here
}catch(exception e){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,e.getmessage()));
}
Adding error handling within a Trigger or database transaction
try{
}catch(DMLException e){
for (Integer i = 0; i < e.getNumDml(); i++) {
// Process exception here
System.debug(e.getDmlMessage(i));
LineItemList [i].adderror(e.getDmlMessage(i));
}
}
Adding error handling within a method
try{
//work here
}catch(exception e){
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,e.getmessage()));
}
Comments
Post a Comment