【发布时间】:2020-05-14 11:12:52
【问题描述】:
最近发生了,我发现我所有的浏览器,chrome,opera,firefox,console都不再显示错误,只是默默地停止js脚本。
console.log(' undefined variable should show error ', aa, bb)
之前,控制台会显示错误:'aa' is undefined,但现在,控制台上没有任何显示,我有最新版本的opera是v66.0.x,chronm是v79.0.x
编辑 2020 年 1 月 29 日
我有点找到问题所在。如果我把
console.log(' undefined variable should show error ', aa, bb)
在常规位置,浏览器会输出:
Uncaught ReferenceError: aa is not defined
但是,如果我将相同的代码放入 fetch 流中,即使此代码已实现、运行到,浏览器、控制台也不会显示任何错误消息,只需停止运行 js 脚本静默!
// ----- fetch.stream api -----
fetch(_url_decoded)
// Retrieve its body as ReadableStream
.then(response => response.body)
.then(rs => {
//console.log('test ', uuuu)
const reader = rs.getReader();
return new ReadableStream({
async start(controller) {
while (true) {
const { done, value } = await reader.read();
// When no more data needs to be consumed, break the reading
if (done) {
console.log('test ', uuuu)
我在所有最新版本的firefox,chrome,opera上测试了这个案例,所有相同的静音停止而不输出任何错误消息!!!
Who can tell me why?
【问题讨论】:
-
也许你有一些
.catch()处理程序?
标签: javascript google-chrome console