get #
Available since 2.17.1
Get a standardized KuzzleError
Arguments #
get (domain: string, subDomain: string, name: string, ...placeholders: unknown[]): KuzzleError| Argument | Type | Description |
|---|---|---|
domain | string | Domain name |
subDomain | string | Subdomain name |
name | string | Standard error name |
placeholders | unknown[] | Other arguments, used to fill the placeholders of the error message (rest parameter) |
Usage #
app.errors.register('app', 'api', 'custom', {
class: 'BadRequestError',
description: 'This is a custom error from API subdomain',
message: 'Custom %s error from %s',
});
throw app.errors.get('app', 'api', 'custom', 'Tbilisi', 'Georgia');