title: Possible Unhandled Promise Rejection (id: 0): ReferenceError: Can't find variable: error
body: <p>My fetch request works fine and returns data but I get possible unhandled promise rejection warning though. I have added catch at the end of the request and catch function does return some data, however the warning does not seem to go away. It also says reference error and it can't find the variable error, I don't understand which variable its referring to. I've looked at resources and I found that usually unhandled promise rejection is because of no catch or that catch does not return anything, but my fetch request has both of them.</p>
  
  <p>Here is my fetch request:</p>
  
  <pre><code>fetch(this.request)
      .then(response =&gt; response.json() )
      .then(response =&gt; {
  
          if(response.token === null){
              return {
                  status:false,
                  message:"Incorrect login credentials",
                  token:response.token
              }
          }
  
          return {
              status:true,
              message:"Login successful"
          }
      },
      reject =&gt; ({
          status:false,
          message:"Something is wrong with the server in reject",
          reject:reject
      }))
      .catch(networkError =&gt; ({
          status:false,
          message:"Something is wrong with the server in catch",
          networkError
      }))
  </code></pre>
  
  <p>Here is the error log:</p>
  
  <pre><code>Possible Unhandled Promise Rejection (id: 0):
  ReferenceError: Can't find variable: error
  _callee$@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:87622:38
  tryCatch@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:13836:44
  invoke@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:14024:30
  http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
  entry.bundle?platform=android&amp;dev=true&amp;hot=false&amp;minify=false:13861:28
  tryCatch@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:13836:44
  invoke@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:13894:28
  http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
  entry.bundle?platform=android&amp;dev=true&amp;hot=false&amp;minify=false:13902:19
  tryCallOne@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:15825:14
  http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
  entry.bundle?platform=android&amp;dev=true&amp;hot=false&amp;minify=false:15911:25
  http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
  entry.bundle?platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6735:24
  _callTimer@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6649:15
  callImmediatesPass@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6877:19
  callImmediates@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6888:39
  __callImmediates@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6248:30
  http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
  entry.bundle?platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6134:32
  __guard@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6234:11
  flushedQueue@http://192.168.2.102:19001/./node_modules/react-native-
  scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6133:19
  flushedQueue@[native code]
  callFunctionReturnFlushedQueue@http://192.168.2.102:19001/./node_modules/react 
  -native-scripts/build/bin/crna-entry.bundle?
  platform=android&amp;dev=true&amp;hot=false&amp;minify=false:6103:31
  callFunctionReturnFlushedQueue@[native code]
  </code></pre>