# Incidents

> Read the problems the store recorded, and clear them, as /oasis incidents does.

Source: https://oasis-protection.com/docs/api/incidents/

An incident is a problem the store recorded that needs a person, such as a damaged file it set aside or a write that failed. Staff see the newest one in `/oasis status`, list them with `/oasis incidents`, and clear them with `/oasis incidents clear`. `oasis.incidents()` does the same from a plugin:

| Method    | Does                                                                |
| --------- | ------------------------------------------------------------------- |
| `list()`  | The incidents that are not cleared, oldest first.                   |
| `clear()` | Clears every incident of the list, and returns the ones it cleared. |

Both return a `CompletableFuture<List<Incident>>` that completes on the main thread. An `Incident` holds `time()`, an `Instant`, and `text()`, which says what went wrong and what to do, in the words the store wrote.

```java
oasis.incidents().list().thenAccept(incidents ->
{
    for (Incident incident : incidents)
    {
        staff.sendMessage(incident.time() + " " + incident.text());
    }
});
```

## Clearing hides an incident

A clear deletes nothing. It hides the incidents from the list, from `/oasis status`, and from the alerts, and the store keeps them. The cairn records each clear with the incidents it hid and who cleared them; a clear from your plugin names your plugin. An incident raised after the clear stays in the list.

A purge by age also hides the incidents older than its cut, and the cairn records them as purged, apart from the cleared ones.

## When a call fails

When the store can’t answer, the future completes exceptionally with an `OasisException`. [When a read fails](/docs/api/reading-history/#when-a-read-fails) lists its reasons and shows how to handle it.
