Przeglądaj źródła

Change relink script error handling #116

Ben Hsieh 8 lat temu
rodzic
commit
42478bdfeb
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9
    2
      src/scripts/prelink.js

+ 9
- 2
src/scripts/prelink.js Wyświetl plik

@@ -6,7 +6,10 @@ var PACKAGE_JSON = process.cwd() + '/package.json';
6 6
 var hasNecessaryFile = fs.existsSync(MANIFEST_PATH) && fs.existsSync(MANIFEST_PATH);
7 7
 
8 8
 if (!hasNecessaryFile) {
9
-  throw 'RNFetchBlob could not found link Android automatically, some files could not be found.'
9
+  console.log('\033[31m*** react-native-fetch-blob pre-link FAILED ***')
10
+  console.log('\033[31mRNFetchBlob could not link Android automatically, some files could not be found.')
11
+  console.log('\033[31mYou may have to manually link the library, see \033[36mhttps://github.com/wkh237/react-native-fetch-blob#manually-link-the-package-android \033[31mfor more information.')
12
+  return
10 13
 }
11 14
 
12 15
 var package = JSON.parse(fs.readFileSync(PACKAGE_JSON));
@@ -20,7 +23,11 @@ console.log('RNFetchBlob detected app version .. ' + VERSION);
20 23
 if(VERSION >= 0.29) {
21 24
   console.log('RNFetchBlob patching MainApplication.java .. ');
22 25
   if(!fs.existsSync(APPLICATION_MAIN)) {
23
-    throw 'RNFetchBlob could not link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN
26
+    console.log('\033[31m*** react-native-fetch-blob pre-link FAILED ***')
27
+    console.log('\033[31mRNFetchBlob could not link Android automatically, MainApplication.java not found in path : ' + APPLICATION_MAIN)
28
+    console.log('\033[31mRNFetchBlob could not link Android automatically, some files could not be found.')
29
+    console.log('\033[31mTry manually link the library, see \033[36mhttps://github.com/wkh237/react-native-fetch-blob#manually-link-the-package-android \033[31mfor more information.')
30
+    return
24 31
   }
25 32
   var main = fs.readFileSync(APPLICATION_MAIN);
26 33
   if(String(main).match('new RNFetchBlobPackage()') !== null) {