Skip to content

Commit 7afb156

Browse files
committed
chore: add an error log when adapter is missing
1 parent 380e7d9 commit 7afb156

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/react-native-executorch/src/utils/ResourceFetcher.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { ResourceSource } from '../types/common';
3232
import { RnExecutorchError } from '../errors/errorUtils';
3333
import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
3434
import { ResourceFetcherUtils } from './ResourceFetcherUtils';
35+
import { Logger } from '../common/Logger';
3536

3637
/**
3738
* Adapter interface for resource fetching operations.
@@ -103,10 +104,14 @@ export class ResourceFetcher {
103104
* **INTERNAL**: Used internally by all resource fetching operations.
104105
*/
105106
static getAdapter(): ResourceFetcherAdapter {
107+
const errorMessage =
108+
'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';
109+
// for sanity :)
110+
Logger.error(errorMessage);
106111
if (!this.adapter) {
107112
throw new RnExecutorchError(
108113
RnExecutorchErrorCode.ResourceFetcherAdapterNotInitialized,
109-
'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'
114+
errorMessage
110115
);
111116
}
112117
return this.adapter;

0 commit comments

Comments
 (0)