promise的then 的问题
来源:8-2 nodejs文件操作

sunleee
2019-06-27
(node:10912) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'then' of undefined
at getPostData.then.postdata (E:\nodejs\blog-2\app.js:45:35)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:10912) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:10912) [DEP0018] 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.
模仿blog1的书写事,在运行时出现这个问题,定位在下面红色款内,提示then这个属性没有定义,研究了很久也没发现问题所在,希望老师有空帮忙看看解答下
这个方法在blog文件这样写的、
还是把getBlogList方法跟exec方法的图片也贴上吧
写回答
1回答
-
双越
2019-06-27
你调用 handleBlogRouter 返回的是 undefined ,你要一行一行代码跟踪看下,应该没有走到你截图的 return 语句中。
一行一行看。
042019-06-30
相似问题
这里promise返回的是什么呢?有点晕
回答 3
一个promise问题
回答 3
promise return的问题
回答 1
promise的then问题
回答 1
关于Promise的理解
回答 3