Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法捕获promise中的错误 #29

Closed
xblxc opened this issue Jun 27, 2017 · 2 comments
Closed

无法捕获promise中的错误 #29

xblxc opened this issue Jun 27, 2017 · 2 comments

Comments

@xblxc
Copy link

xblxc commented Jun 27, 2017

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta content="telephone=no" name="format-detection" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="default" name="apple-mobile-web-app-status-bar-style">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title></title>
</head>
<body>
    <script src="//cdn.jsdelivr.net/eruda/1.2.2/eruda.min.js"></script>
    <script>eruda.init();</script> 
    <script>
        new Promise(function(resolve, reject){
            resolve();
        }).then(function(res){
            var a = res.a;
        })
    </script>
</body>
</html>

浏览器可以捕捉到错误:

(index):18 Uncaught (in promise) TypeError: Cannot read property 'a' of undefined
    at (index):18
    at <anonymous>
surunzi added a commit that referenced this issue Jun 28, 2017
@surunzi
Copy link
Member

surunzi commented Jul 3, 2017

试下最新的1.2.4版

@surunzi surunzi closed this as completed Jul 6, 2017
@lili21
Copy link

lili21 commented Sep 10, 2018

如果是非原生的Promise呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants