You need to sign in to do that
Don't have an account?
sharathchandra thukkani
Need to capture the stack trace when Database.Error is Used
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());
}
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());
}
sharathchandra thukkani
I can try this but due to time factor i have posted this..
Deepak Veeravalli 10
Hi SharathChandra, Am alos in the same situation like you. Was wondering if you were able to achieve this.