---
url: https://trigger.beyondthecloud.dev/before-delete/add-ons/continue-on-error.md
description: >-
  Let a before delete Validator or Writer fail without failing the delete - its
  exception is logged and swallowed.
---

# BeforeDelete.ContinueOnError

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

**Signature**

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

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

**Example**

::: code-group

```apex [Skeleton]
public with sharing class ContactValidator implements BeforeDelete.Validator, BeforeDelete.ContinueOnError {
    public Boolean addErrorOnBeforeDeleteWhen(TriggerTypes.DeleteRecord record) {
        return record.isTrue(Contact.DoNotCall);
    }

    public void addErrorOnBeforeDelete(TriggerTypes.RejectableDeleteRecord record) {
        record.addError('A Do Not Call contact cannot be deleted.');
    }
}
```

:::

## Rules {#rules}

* **The rest of the handler is skipped.** After an exception, this handler's remaining records and its Finalizer are skipped. An exception in a provider stops the handler where the provider is first read.
* **A Writer gets the automatic unit of work.** Unless it implements OwnUnitOfWork, its writes commit right after it, so a failure never touches other Writers' writes.
* **Some errors still fail the delete.** [Library exceptions](/api/trigger-orchestrator#triggerlibexception), `System.LimitException` and exceptions outside the handler's own methods, such as `bypassOnBeforeDeleteWhen()`, `queryPriorParentsOnBeforeDelete()` or the final commit, are never swallowed.
* **Add a [Logger](/guide/error-handling#logger).** Without one, a swallowed exception leaves no trace.

::: warning
Never add it to a Validator that guards a delete. A swallowed exception means no error is attached, so the record is deleted.
:::
