File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 DownloadStatus ,
88 SourceType ,
99 ResourceSourceExtended ,
10+ RnExecutorchError ,
11+ RnExecutorchErrorCode ,
1012} from 'react-native-executorch' ;
1113import { Image } from 'react-native' ;
1214import * as RNFS from '@dr.pogodin/react-native-fs' ;
@@ -82,7 +84,15 @@ export namespace ResourceFetcherUtils {
8284
8385 export async function createDirectoryIfNoExists ( ) {
8486 if ( ! ( await checkFileExists ( RNEDirectory ) ) ) {
85- await RNFS . mkdir ( RNEDirectory ) ;
87+ try {
88+ await RNFS . mkdir ( RNEDirectory ) ;
89+ } catch ( error ) {
90+ throw new RnExecutorchError (
91+ RnExecutorchErrorCode . AccessFailed ,
92+ `Failed to create directory at ${ RNEDirectory } ` ,
93+ error
94+ ) ;
95+ }
8696 }
8797 }
8898
Original file line number Diff line number Diff line change 77 DownloadStatus ,
88 SourceType ,
99 ResourceSourceExtended ,
10+ RnExecutorchError ,
11+ RnExecutorchErrorCode ,
1012} from 'react-native-executorch' ;
1113import { Asset } from 'expo-asset' ;
1214
@@ -95,7 +97,15 @@ export namespace ResourceFetcherUtils {
9597
9698 export async function createDirectoryIfNoExists ( ) {
9799 if ( ! ( await checkFileExists ( RNEDirectory ) ) ) {
98- await makeDirectoryAsync ( RNEDirectory , { intermediates : true } ) ;
100+ try {
101+ await makeDirectoryAsync ( RNEDirectory , { intermediates : true } ) ;
102+ } catch ( error ) {
103+ throw new RnExecutorchError (
104+ RnExecutorchErrorCode . AccessFailed ,
105+ `Failed to create directory at ${ RNEDirectory } ` ,
106+ error
107+ ) ;
108+ }
99109 }
100110 }
101111
You can’t perform that action at this time.
0 commit comments