requireAdmin
function requireAdmin(message?: string): void;
The assertion form of isAdmin, and the one to put at the top of anything destructive. It returns nothing: either the call continues or it does not.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The message of the exception. A default is used when omitted. |
Returns
void — nothing; it either passes or throws.
Throws
Exception | Condition |
|---|---|
| the active user is not an administrator. |
Examples
Guarding an action
function deleteEverything() {
requireAdmin("Only an administrator may run this.");
// …
}
See also
Source
23 September 2026
This documentation was generated with AI (Claude) from the library's source code.