function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
111111 

how can i get the number of failed rows for Exception?

there is  getNumDml()-method  for DML exceptions?
 
anyone know the method  to get the Apex-code-Exception' rows?
 
i want to returns the number of failed rows for the Excetion Not DML exceptions. 
 
 
try {
       OpportunityLineItem newAcct = new OpportunityLineItem(Description  ='testdddd');
        insert newAcct;
}catch (Exception e) {
        List<String> listStack = new List<String>();
       
 
        //  method is not getNumDml(Returns the number of failed rows for DML exceptions)
        listStack.add(String.valueOf(   method   ); 
 
       
        listStack.add(e.getTypeName());
}   
SuperfellSuperfell
See http://www.salesforce.com/us/developer/docs/apexcode/index_CSH.htm#apex_classes_exception_methods.htm
111111

thank  you for your help

but i don't want to get the  System.DMLException'error - row, i want to get the  Exception'error - row

 i want to get the Exception'error - row-method  like the method(e.getNumDml()),but not  e.getNumDml()

e.getNumDml() :    Returns the number of failed rows for DML exceptions.

try {

   BMessageBean bbbMessageBean = null;

   bbbMessageBean.resMessage = 'd';

}catch (Exception e) {

      bMessageBean.listStack.add(String.valueOf(e.getNumDml()));

}

i got the error:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode:
 faultString: System.TypeException: Procedure is only valid for System.DmlException and System.MailException

SuperfellSuperfell
there is no row based error on Exception, its on DmlException.
111111
my source is
 
client :
 
try {
   
    //WebService  - method
 
    //b.listStack(0)          *  apex-code-error-row : line  3
 
} catch (RemoteException e) {
   e.printStackTrace();
}
 
 
 
WebService:
 
1  try {
       BMessageBean bbbMessageBean = null;
3        bbbMessageBean.resMessage = 'd';
4 catch (Exception e) {
    
          //class.s.B03WebService.b03SvMain: line 3,
5        b.listStack.add(  apex-code-error'rows -method);
 
   }
   return    b;
 
 
 
no method  can  get apex-code-error-rows?when Exception is appeared.
 
 
SuperfellSuperfell
You mean you want a stack trace? AFAIK, there isn't one available other than via the debug log.
111111
yes
 
Apex - code :i want the apex-code-error'rows to give  to the list[0].  and then
 
JAVA - code :list[0].getErrorLine    //get the apex-code-error'line
 
 
Apex - code can't get the error'row.
 
 
SuperfellSuperfell
i don't think its available.