What happens if an unhandled exception occurs inside a trigger during a bulk DML operation (insert list vs Database.insert(list, false))?
Answer
insert list;(all-or-none): if any record fails or an uncaught exception occurs, the whole DML rolls back and aDmlExceptionis thrown.Database.insert(list, false): partial success is allowed. Records failing validation oraddError()are reported inSaveResults, others commit.
Important: an unhandled exception thrown inside trigger code (like a NullPointerException) is not a per-record failure; it fails the whole chunk and rolls it back, even with allOrNone=false. Use addError for record-level failures and try/catch for expected exceptions.
apex-triggertriggerdmlexception-handling