Skip to content

Commit 8e22713

Browse files
committed
chore: add an error log when adapter is missing
1 parent 54bec55 commit 8e22713

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.
@@ -115,10 +116,14 @@ export class ResourceFetcher {
115116
* **INTERNAL**: Used internally by all resource fetching operations.
116117
*/
117118
static getAdapter(): ResourceFetcherAdapter {
119+
const errorMessage =
120+
'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';
121+
// for sanity :)
122+
Logger.error(errorMessage);
118123
if (!this.adapter) {
119124
throw new RnExecutorchError(
120125
RnExecutorchErrorCode.ResourceFetcherAdapterNotInitialized,
121-
'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'
126+
errorMessage
122127
);
123128
}
124129
return this.adapter;

0 commit comments

Comments
 (0)