# setCustomIdErrors

`function` in `custom-id` · v0.2.1

<https://docs.seedcord.org/packages/custom-id/0.2.1/set-custom-id-errors>

Replace what [`decode`](/packages/custom-id/0.2.1/classes/custom-id#decode) throws. One registration covers the whole process. The last call wins. Call this before any interaction is received.

The stale constructor receives the route prefix. The invalid one receives a detail string. Neither carries the interaction. A per-user locale cannot reach either one.

A [seedcord](https://seedcord.org) bot already calls this at import, swapping both defaults for `Notice` subclasses that render a card. Call it again with your own to change what the user reads. Return a `Notice` subclass from each arm. A plain `Error` would otherwise reach the user as the generic fault card.

```ts
setCustomIdErrors(errors: CustomIdErrors): void
```

Replace what [`decode`](/packages/custom-id/0.2.1/classes/custom-id#decode) throws. One registration covers the whole process. The last call wins. Call this before any interaction is received.

The stale constructor receives the route prefix. The invalid one receives a detail string. Neither carries the interaction. A per-user locale cannot reach either one.

A [seedcord](https://seedcord.org) bot already calls this at import, swapping both defaults for `Notice` subclasses that render a card. Call it again with your own to change what the user reads. Return a `Notice` subclass from each arm. A plain `Error` would otherwise reach the user as the generic fault card.

Parameters.

- `errors` `CustomIdErrors` — Constructors for the two failure cases.

Returns `void`.
