Monday 3 April 2023

Exception Handling in Apex Part 3 | Common Exception Methods in Apex | Salesforce Development

              In this post, we will see Exception Handling in Apex Part 3 | Common Exception Methods in Apex | Salesforce Development 


Program Code

System.debug('Before Exception');

try{

Double result=10/0;

}

catch(MathException e){

    System.debug('Cause:'+e.getCause());

    System.debug('Message:'+e.getMessage());

    System.debug('Line Number:'+e.getLineNumber());

    System.debug('Stack Trace:'+e.getStackTraceString());

    System.debug('Type Name:'+e.getTypeName());

finally{

    System.debug('In Finally Block');

}

System.debug('After Exception');

No comments:

Post a Comment