# Retry

If the activities inside it throw an error, runs them again at set intervals. When the body finishes without error, the activity also finishes.


---

### :arrow_left:**INPUT**

| **Parameter** | **Type** | **Required** | **Description** |
|-----------|------|----------|-------------|
| `Condition` | `Boolean` | ❌ No     | Whether to retry after a failed attempt. If True, it is retried; if False, the attempts stop. If left empty, it is retried until the attempts run out. |
| `NumberOfAttempts` | `Int32` | ✅ Yes    | The maximum number of times the body runs, including the first run. Default: `3`. 0 or a negative value counts as 3. |
| `RetryInterval` | `TimeSpan` | ❌ No     | The time to wait between attempts. If left empty or 0, 5 seconds. |


---

### :arrow_down:**MISC**

| **Parameter** | **Type** | **Default** | **Description** |
|-----------|------|---------|-------------|
| `ThrowException` | `Boolean` | `False` | If True, the last error is thrown when the attempts end with an error. If False, the activity finishes without error. |


---

### Usage

* On the canvas there is the body area (**Add Activity**), and below it the **Number of Attempts** and **Throw Exception** (**Yes** / **No**) fields. **Condition** and **Retry Interval** are set in the properties panel.
* The body runs. If it finishes without error, the activity finishes.
* If the body throws an error and attempts remain, `Condition` is evaluated. If `Condition` is True or empty, it waits for `RetryInterval` and the body runs again.
* If the attempts run out or `Condition` becomes False, no retry is made. If `ThrowException` is True, the error of the last attempt is thrown; the type and message of the error do not change, and it can be caught by type with **Try Catch**. In the error notification, if more than one attempt was made it says "All N attempts failed. Last error: …"; if it stopped because of the condition it says "Not retried after attempt N because the condition is False. Last error: …".
* If **Break** or **Continue** is used inside the body, that attempt stops and no retry is made.