Skip to content

Commit 92924b4

Browse files
rizalibnumsluszniak
authored andcommitted
chore: replace generic error with RnExecutorchError in ResourceFetcher for better error handling
1 parent e445638 commit 92924b4

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,8 @@
2929
*/
3030

3131
import { ResourceSource } from '../types/common';
32-
import {
33-
ResourceFetcherUtils,
34-
HTTP_CODE,
35-
DownloadStatus,
36-
SourceType,
37-
ResourceSourceExtended,
38-
DownloadResource,
39-
} from './ResourceFetcherUtils';
40-
import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
4132
import { RnExecutorchError } from '../errors/errorUtils';
33+
import { RnExecutorchErrorCode } from '../errors/ErrorCodes';
4234

4335
export interface ResourceFetcherAdapter {
4436
fetch(
@@ -70,7 +62,8 @@ export class ResourceFetcher {
7062

7163
static getAdapter(): ResourceFetcherAdapter {
7264
if (!this.adapter) {
73-
throw new Error(
65+
throw new RnExecutorchError(
66+
RnExecutorchErrorCode.NotImplemented,
7467
'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.'
7568
);
7669
}

0 commit comments

Comments
 (0)