English 中文(简体)
可能的无处理注射(同上:0): 参考资料: Can t 发现变量:错误
原标题:Possible Unhandled Promise Rejection (id: 0): ReferenceError: Can t find variable: error

我的恳切请求提供了优质和回报数据,但我有可能通过未经处理的承诺拒绝警告。 在请求结束时,我增加了渔获量,捕获功能确实收回了一些数据,但警告似乎并没有消失。 它还说了参考错误,它可能发现有变的错误,我不理解,它指的是什么。 我审视了资源,我发现,通常不相干的拒绝承诺是因为没有捕获物,或者捕获量不会退回任何东西,但我的恳求双方都有这种要求。

Here is my fetch request:

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
_callee$@http://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
tryCatch@http://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
invoke@http://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
tryCatch@http://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
invoke@http://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
tryCallOne@http://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
_callTimer@http://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
callImmediatesPass@http://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
callImmediates@http://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
__callImmediates@http://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
__guard@http://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
flushedQueue@http://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
flushedQueue@[native code]
callFunctionReturnFlushedQueue@http://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
callFunctionReturnFlushedQueue@[native code]
问题回答
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"
        });
    })
    .catch(networkError => (
    return(
    {
        status:false,
        message:"Something is wrong with the server in catch",
        networkError
    }
    )
    ))

开放和封闭的方括号中可能会有几处 up。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签