Skip to content

Commit 0da8227

Browse files
authored
Update failures-and-recovery.md
1 parent 896f701 commit 0da8227

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/failures-and-recovery.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,28 @@ class MyWorkflow extends Workflow
4141
}
4242
```
4343

44+
## Non-retryable Exceptions
45+
46+
In certain cases, you may encounter exceptions that should not be retried. These are referred to as non-retryable exceptions. When an activity throws a non-retryable exception, the workflow will immediately mark the activity as failed and stop retrying.
47+
48+
```php
49+
use Workflow\Activity;
50+
use Workflow\Exceptions\NonRetryableException;
51+
52+
class MyNonRetryableActivity extends Activity
53+
{
54+
public function execute()
55+
{
56+
throw new NonRetryableException('This is a non-retryable error');
57+
}
58+
}
59+
```
60+
4461
## Failing Activities
4562

4663
The default value for `$tries` is 0 which means to retry forever. This is because the retry policy includes a backoff function which increases the delay between each retry attempt. This gives you time to fix the error without creating too many attempts.
4764

48-
There are two types of errors that can occur in a activity: recoverable errors and non-recoverable errors. Recoverable errors are temporary and can be resolved without intervention, such as a timeout or temporary network failure. Non-recoverable errors require manual intervention, such as a deployment or code change.
65+
There are two types of failures that can occur in a activity: recoverable failures and non-recoverable failures. Recoverable failures are temporary and can be resolved without intervention, such as a timeout or temporary network failure. Non-recoverable failures require manual intervention, such as a deployment or code change.
4966

5067
## Recovery Process
5168

0 commit comments

Comments
 (0)