UtilityApiError
Electron APIs / utility / UtilityApiError
The value a failed elevation call rejects with: installHighElevationHelper(),
isHighElevationHelperInstalled(), canInjectElevated(),
installElevationBroker() and uninstallElevationBroker().
It is a plain object, not an Error instance: err instanceof Error is
false, and there is no stack trace.
Example
try {
await api.installElevationBroker();
} catch (err) {
const { message, exitCode } = err as UtilityApiError;
if (exitCode === 1223) {
console.warn("User cancelled UAC prompt");
} else {
console.error("Broker install failed:", message, exitCode);
}
}