From 7afb15653b2254b0011b8371c2cbd997d80b47a7 Mon Sep 17 00:00:00 2001 From: chmjkb Date: Mon, 23 Mar 2026 15:06:06 +0100 Subject: [PATCH 1/2] chore: add an error log when adapter is missing --- .../react-native-executorch/src/utils/ResourceFetcher.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/react-native-executorch/src/utils/ResourceFetcher.ts b/packages/react-native-executorch/src/utils/ResourceFetcher.ts index bd92c07f2..36016fd5a 100644 --- a/packages/react-native-executorch/src/utils/ResourceFetcher.ts +++ b/packages/react-native-executorch/src/utils/ResourceFetcher.ts @@ -32,6 +32,7 @@ import { ResourceSource } from '../types/common'; import { RnExecutorchError } from '../errors/errorUtils'; import { RnExecutorchErrorCode } from '../errors/ErrorCodes'; import { ResourceFetcherUtils } from './ResourceFetcherUtils'; +import { Logger } from '../common/Logger'; /** * Adapter interface for resource fetching operations. @@ -103,10 +104,14 @@ export class ResourceFetcher { * **INTERNAL**: Used internally by all resource fetching operations. */ static getAdapter(): ResourceFetcherAdapter { + const errorMessage = + 'ResourceFetcher adapter is not initialized. Please call initExecutorch({ resourceFetcher: ... }) with a valid adapter, e.g., from react-native-executorch-expo-resource-fetcher or react-native-executorch-bare-resource-fetcher. For more details please refer: https://docs.swmansion.com/react-native-executorch/docs/next/fundamentals/loading-models'; + // for sanity :) + Logger.error(errorMessage); if (!this.adapter) { throw new RnExecutorchError( RnExecutorchErrorCode.ResourceFetcherAdapterNotInitialized, - 'ResourceFetcher adapter is not initialized. Please call initExecutorch({ resourceFetcher: ... }) with a valid adapter, e.g., from react-native-executorch-expo-resource-fetcher or react-native-executorch-bare-resource-fetcher. For more details please refer: https://docs.swmansion.com/react-native-executorch/docs/next/fundamentals/loading-models' + errorMessage ); } return this.adapter; From b2adb29727a52f68ed0c66ea4ec655522a4c4da9 Mon Sep 17 00:00:00 2001 From: chmjkb Date: Mon, 23 Mar 2026 15:32:26 +0100 Subject: [PATCH 2/2] fix: move the error log --- .../react-native-executorch/src/utils/ResourceFetcher.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native-executorch/src/utils/ResourceFetcher.ts b/packages/react-native-executorch/src/utils/ResourceFetcher.ts index 36016fd5a..52a3d1ca9 100644 --- a/packages/react-native-executorch/src/utils/ResourceFetcher.ts +++ b/packages/react-native-executorch/src/utils/ResourceFetcher.ts @@ -104,11 +104,11 @@ export class ResourceFetcher { * **INTERNAL**: Used internally by all resource fetching operations. */ static getAdapter(): ResourceFetcherAdapter { - const errorMessage = - 'ResourceFetcher adapter is not initialized. Please call initExecutorch({ resourceFetcher: ... }) with a valid adapter, e.g., from react-native-executorch-expo-resource-fetcher or react-native-executorch-bare-resource-fetcher. For more details please refer: https://docs.swmansion.com/react-native-executorch/docs/next/fundamentals/loading-models'; - // for sanity :) - Logger.error(errorMessage); if (!this.adapter) { + const errorMessage = + 'ResourceFetcher adapter is not initialized. Please call initExecutorch({ resourceFetcher: ... }) with a valid adapter, e.g., from react-native-executorch-expo-resource-fetcher or react-native-executorch-bare-resource-fetcher. For more details please refer: https://docs.swmansion.com/react-native-executorch/docs/next/fundamentals/loading-models'; + // for sanity :) + Logger.error(errorMessage); throw new RnExecutorchError( RnExecutorchErrorCode.ResourceFetcherAdapterNotInitialized, errorMessage