Skip to content
Docs
Reference

Function: extractPermissionFromError()

Function: extractPermissionFromError() in @ticketlayer/backstage.

@ticketlayer/backstage


@ticketlayer/backstage / extractPermissionFromError

function extractPermissionFromError(error: unknown): string | undefined;

Defined in: client.ts:630

The permission named in an API refusal's message, from either wording the API uses: "You need the integrations.read permission" (a route's guard) or "Permission denied: roles.read:all required" (older handlers, with the account scope dropped). Pass the message, or the thrown value itself: it is read by shape (message), not by instanceof, because a bundle can hold two copies of this class. Undefined when neither wording names one.

Parameters#

ParameterType
errorunknown

Returns#

string | undefined