0
フェッチ要求が正常に動作し、データを返しますが、未処理の約束拒否警告も発生します。私は要求の最後にcatchを追加し、catch関数はいくつかのデータを返しますが、警告は消え去っていないようです。それはまた、参照エラーと言うと、変数エラーを見つけることができない、私はどの変数を参照して理解していない。私はリソースを調べましたが、通常は処理されていない約束の拒否はキャッチがないか、キャッチが何も返されないことがわかりましたが、フェッチ要求には両方があります。ここで可能性のある未処理プロミス拒否(ID:0):ReferenceError:変数を見つけることができません:エラー
は私の要求フェッチである:ここでは
fetch(this.request)
.then(response => response.json())
.then(response => {
if(response.token === null){
return {
status:false,
message:"Incorrect login credentials",
token:response.token
}
}
return {
status:true,
message:"Login successful"
}
},
reject => ({
status:false,
message:"Something is wrong with the server in reject",
reject:reject
}))
.catch(networkError => ({
status:false,
message:"Something is wrong with the server in catch",
networkError
}))
をエラーログです:
Possible Unhandled Promise Rejection (id: 0):
ReferenceError: Can't find variable: error
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:87622:38
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:13836:44
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:14024:30
http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
entry.bundle?platform=android&dev=true&hot=false&minify=false:13861:28
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:13836:44
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:13894:28
http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
entry.bundle?platform=android&dev=true&hot=false&minify=false:13902:19
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:15825:14
http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
entry.bundle?platform=android&dev=true&hot=false&minify=false:15911:25
http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
entry.bundle?platform=android&dev=true&hot=false&minify=false:6735:24
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6649:15
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6877:19
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6888:39
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6248:30
http://192.168.2.102:19001/./node_modules/react-native-scripts/build/bin/crna-
entry.bundle?platform=android&dev=true&hot=false&minify=false:6134:32
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6234:11
[email protected]://192.168.2.102:19001/./node_modules/react-native-
scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6133:19
[email protected][native code]
[email protected]://192.168.2.102:19001/./node_modules/react
-native-scripts/build/bin/crna-entry.bundle?
platform=android&dev=true&hot=false&minify=false:6103:31
[email protected][native code]
これはまだ動作しません。あなたが呼び出している機能の拒否と解決に関する知識を私に与えてくれますか? –
私は答えを更新しました。解決と拒否については、「約束」 –