diff --git a/src/framework/core/services/ErrorsService.ts b/src/framework/core/services/ErrorsService.ts index cdd0c46..ff18d71 100644 --- a/src/framework/core/services/ErrorsService.ts +++ b/src/framework/core/services/ErrorsService.ts @@ -71,6 +71,19 @@ export default class ErrorsService extends Service { UI.openModal(UI.resolveComponent(ApplicationComponent.ErrorReportModal), { reports }); } + public reportDevelopmentError(error: ErrorSource, message?: string): void { + if (!App.isDevelopment) { + return; + } + + if (message) { + // eslint-disable-next-line no-console + console.warn(message); + } + + this.logError(error); + } + public async report(error: ErrorSource, message?: string): Promise { if (await this.handleError(error)) { return; diff --git a/src/services/KitchenService.ts b/src/services/KitchenService.ts index 85fb9d4..89daf27 100644 --- a/src/services/KitchenService.ts +++ b/src/services/KitchenService.ts @@ -3,6 +3,7 @@ import { toRaw } from 'vue'; import type { RouteLocationRaw } from 'vue-router'; import App from '@/framework/core/facades/App'; +import Errors from '@/framework/core/facades/Errors'; import Events from '@/framework/core/facades/Events'; import Router from '@/framework/core/facades/Router'; import Service from '@/framework/core/Service'; @@ -40,7 +41,7 @@ export default class CookbookService extends Service = ['dish', 'timers', 'wakeLock', 'lastRoute']; - private screenLock: Promise<{ release(): Promise }> | null = null; + private screenLock: Promise }> | null = null; private timeouts: WeakMap> = new WeakMap(); public async open(): Promise { @@ -191,7 +192,13 @@ export default class CookbookService extends Service { + Errors.reportDevelopmentError(error, 'Could not request screen wake lock'); + }); + } catch (error) { + Errors.reportDevelopmentError(error, 'Could not request screen wake lock'); + } } protected releaseScreen(): void { @@ -199,7 +206,7 @@ export default class CookbookService extends Service lock.release()); + this.screenLock.then(lock => lock?.release()); this.screenLock = null; }