---
url: https://trigger.beyondthecloud.dev/before-update/add-ons/continue-on-error.md
description: >-
  Let a non-critical before update handler fail without failing the update. The
  exception is logged and swallowed.
---

# BeforeUpdate.ContinueOnError

Log and swallow the handler's exceptions, so later handlers still run and the update goes on.

**Signature**

```apex
public interface ContinueOnError {
}
```

`BeforeUpdate.ContinueOnError` has no methods: implementing it is the whole opt-in.

**Example**

::: code-group

```apex [Skeleton]
public with sharing class ContactPopulator implements BeforeUpdate.Populator, BeforeUpdate.ContinueOnError {
    public Boolean populateOnBeforeUpdateWhen(TriggerTypes.UpdateRecord record) {
        return record.isChanged(Contact.Email);
    }

    public void populateOnBeforeUpdate(TriggerTypes.UpdateRecord record) {
        record.put(Contact.HasOptedOutOfEmail, false);
    }
}
```

:::

## Rules {#rules}

* **One failure stops the handler for the chunk.** Its remaining records and its Finalizer are skipped. Values it already set stay. To skip only one record, catch the exception in the action.
* **Some exceptions still fail the update.** DML in the handler, a Validator that attaches no error, `TriggerTypes.TriggerLibException`, `System.LimitException`, the `FinalException` from touching the old row and exceptions from methods that run before the handler's turn, such as `bypassOnBeforeUpdateWhen()`, are never swallowed.
* **Add a [Logger](/guide/error-handling#logger).** Without one, a swallowed exception leaves no trace.

::: warning
Keep it off Validators that protect data. When such a Validator throws, the records it has not checked yet save unchecked.
:::
