From f91adb13be302bb501df1f75b10d309432f730cb Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 24 Oct 2023 13:44:03 +0200 Subject: [PATCH] fix: Use same error message --- package/src/FrameProcessorPlugins.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/package/src/FrameProcessorPlugins.ts b/package/src/FrameProcessorPlugins.ts index 8159fcf..ee99048 100644 --- a/package/src/FrameProcessorPlugins.ts +++ b/package/src/FrameProcessorPlugins.ts @@ -37,13 +37,12 @@ interface TVisionCameraProxy { initFrameProcessorPlugin: (name: string, options?: Record) => FrameProcessorPlugin | undefined } +const errorMessage = 'Frame Processors are not available, react-native-worklets-core is not installed!' + let hasWorklets = false let isAsyncContextBusy = { value: false } let runOnAsyncContext = (_frame: Frame, _func: () => void): void => { - throw new CameraRuntimeError( - 'system/frame-processors-unavailable', - 'Frame Processors are not available, react-native-worklets-core is not installed!', - ) + throw new CameraRuntimeError('system/frame-processors-unavailable', errorMessage) } try { @@ -74,13 +73,13 @@ try { let proxy: TVisionCameraProxy = { initFrameProcessorPlugin: () => { - throw new CameraRuntimeError('system/frame-processors-unavailable', 'Frame Processors are not enabled!') + throw new CameraRuntimeError('system/frame-processors-unavailable', errorMessage) }, removeFrameProcessor: () => { - throw new CameraRuntimeError('system/frame-processors-unavailable', 'Frame Processors are not enabled!') + throw new CameraRuntimeError('system/frame-processors-unavailable', errorMessage) }, setFrameProcessor: () => { - throw new CameraRuntimeError('system/frame-processors-unavailable', 'Frame Processors are not enabled!') + throw new CameraRuntimeError('system/frame-processors-unavailable', errorMessage) }, } if (hasWorklets) {