# setCustomIdErrors

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

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

Replace what [`decode`](/docs/packages/custom-id/0.2.7/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`](/docs/packages/custom-id/0.2.7/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`.
