# trigger.error

Runs when a request to this project ends in an HTTP error that no pipeline answered

# trigger.error

```
trigger.error [--status TEXT] → error
```

Runs when a request to this project ends in an HTTP error that no pipeline answered. It covers a `/wh/…` path nobody registered (404), a refused auth (401/403), a failed node (500). `--status` picks which: `404`, `4xx`, `5xx`, or empty for all. Answers one key, `error`: `{ error_code, error_message, original_path, method, request_id }` (`input.error.error_code`, `$trigger.error_code`) — there is no `body`. End in `web.response.send --template pages/not-found.tsx --status 404` to serve a designed error page; without `--status` the page answers 200 and browsers and crawlers treat the error as a success. One pipeline per code range; the most specific wins.

## Flags

- `--status`: The HTTP status this pipeline answers: an exact status (404), a range (4xx, 5xx), or empty for every error.

## Examples

### A designed 404

```
| trigger.error --status 404
```

Then `| web.response.send --template pages/not-found.tsx --status 404`.

It answers:

```json
{
  "error": {
    "error_code": 404,
    "error_message": "Not Found",
    "original_path": "/blog/old-post",
    "method": "GET",
    "request_id": "weberror-404"
  }
}
```
