Chrome appears to report wrong line for error

独自空忆成欢 提交于 2019-12-31 01:58:18

问题


I'm getting an error on line 975 ( this is what the console reports ), but when I look at the code it is clearly not 975.

Cannot read property E of undefined:

Here is a screenshot:

Here is the screenshot showing the disparity for ...


回答1:


It's possible Chrome isn't reporting the specific line, but using line 975 as a reference to the segment of the code where property E doesn't seem to be found, thus line 975 could be in the middle of whatever code is problematic (some debuggers do this instead of reporting the first line they find a problem on - maybe Chrome's interpreter works like this, I don't know though, since I use Firefox for development instead). In that case, it would mean that this is what's undefined and there's your problem.

We'd have to see more to get a grip on why this would be happening since we can't determine what the context for this is from the screenshot. What is the expected value of this and if this is part of an object definition that you instantiate later, how do you instantiate it, as the context could matter for the value of this.



来源:https://stackoverflow.com/questions/24706945/chrome-appears-to-report-wrong-line-for-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!