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());
}