• Deepak Veeravalli 10
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi
Below is my sample code where i'm inserting the error occured for DML operation into SFDC_Log__c object. Can i capture the Stack Trace by using substring and index concept over here, have any one tried. It will also be helpful if any once can post the exact error message how it looks.

 //log bad Inserts
                    if(!objResult.isSuccess()){
                        Database.Error err =  objResult.getErrors()[0];
                        objSfdcLog = new SFDC_Log__c();
                        objSfdcLog.Error_Message__c = err.getMessage().substring(0,255);
                        objSfdcLog.ToAddress__c = strToAddress;
                        objSfdcLog.FromAddress__c = strFromAddress;
                        lstSFDCLog.add(objSfdcLog);
                        System.Debug('######## Error while inserting Case: '+err.getStatusCode()+' '+err.getMessage());
                    }