nitinkgarg
11/30/2017 - 3:54 AM

Exceptions

try {
  // This causes an exception because
  // the required Name field is not provided
  
  Account acct = new Account();
  //Insert the Account
  insert accnt;
} catch (DMLException e) {
  System.debug('A DML exception has occured: ' + e.getMessage());
}