Whether error is the server refusing, and — given key — refusing with that key.
try {
await useService('journal').call('create', { title });
} catch (error) {
if (isRefusal(error, 'server.rateLimited')) return showSlowDown();
throw error;
}
Matches on the key the server sent, never on the message, so a reworded or translated
catalog changes nothing here. A plain Error — whatever its message, and whatever key
property somebody hung on it — is not a refusal.
The keys are the shell's server catalog's (web/src/shell/locales/server.en.json). What
an add-on's own service can answer with is a short list — server.rateLimited,
server.notAuthenticated, server.endpoint.appDisabled (the owner switched the app off)
and server.generic — because its handlers' refusals carry no key.
Optionalkey: string
Which refusal it was (MICA-310), for the same caller
messageOfserves: an app or add-on holding a rejectedcall.messageOfsays what to show;isRefusal(error, key)says what happened, by the catalog key the server named rather than by text a translator can reword. Both barrels, because a sandboxed add-on's rejection is rebuilt as aServiceRefusalon its side of the wall (host/iframe/remote.ts). The class is exported beside the guard so an add-on's own tests can make one;sdk/lib/errors.tssays what it is and is not.