fix: Use same error message

This commit is contained in:
Marc Rousavy 2023-10-24 13:44:03 +02:00
parent fcefc7f9d9
commit f91adb13be
No known key found for this signature in database
GPG Key ID: 8B9C709EA0B16A6D

View File

@ -37,13 +37,12 @@ interface TVisionCameraProxy {
initFrameProcessorPlugin: (name: string, options?: Record<string, ParameterType>) => 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) {