代码调试了n遍,都正常,node为什么会报如下错误:
(node:18) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot read property '1' of null
(node:18) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
这是代码,调试的一切正常
...
case 49:
let title = content.match(/<title>(.*)<\/title>/)[1];
let des = content.match(/<des>(.*)<\/des>/)[1];
let link = content.match(/<url>(.*)<\/url>/)[1];
content = `APP:` +
`标题:${title}\n` + //这里的变量都显示正常
`描述:${des}\n` + //这里的变量都显示正常
`链接:${link}`; //这里的变量都显示正常
break;
...
看报错信息很明显
这里有东西没有匹配到,所以null[1]出错