Skip to content

Commit 359427b

Browse files
committed
chore: replace generic error with RnExecutorchError in ResourceFetcher for better error handling
1 parent 3638069 commit 359427b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030

3131
import { ResourceSource } from '../types/common';
32+
import { RnExecutorchError } from '../errors/errorUtils';
33+
import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
3234

3335
export interface ResourceFetcherAdapter {
3436
fetch(
@@ -54,7 +56,8 @@ export class ResourceFetcher {
5456

5557
static getAdapter(): ResourceFetcherAdapter {
5658
if (!this.adapter) {
57-
throw new Error(
59+
throw new RnExecutorchError(
60+
RnExecutorchErrorCode.NotImplemented,
5861
'ResourceFetcher adapter is not initialized. Please call initExecutorch({ resourceFetcher: ... }) with a valid adapter, e.g., from @rn-executorch/expo-adapter or @rn-executorch/bare-adapter.'
5962
);
6063
}

0 commit comments

Comments
 (0)