mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-09-13 04:08:22 +02:00
Improve loading speed of desktop app (#4865)
# Description of Changes Improve loading speed of desktop app by loading a default config until the backend has spawned.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import i18n from '@app/i18n';
|
||||
|
||||
export const BACKEND_NOT_READY_CODE = 'BACKEND_NOT_READY' as const;
|
||||
|
||||
export interface BackendNotReadyError extends Error {
|
||||
code: typeof BACKEND_NOT_READY_CODE;
|
||||
}
|
||||
|
||||
export function createBackendNotReadyError(): BackendNotReadyError {
|
||||
return Object.assign(new Error(i18n.t('backendHealth.starting', 'Backend starting up...')), {
|
||||
code: BACKEND_NOT_READY_CODE,
|
||||
});
|
||||
}
|
||||
|
||||
export function isBackendNotReadyError(error: unknown): error is BackendNotReadyError {
|
||||
return typeof error === 'object'
|
||||
&& error !== null
|
||||
&& 'code' in error
|
||||
&& (error as { code?: unknown }).code === BACKEND_NOT_READY_CODE;
|
||||
}
|
||||
Reference in New Issue
Block a user