0
我有我的代碼被觸發警告的錯誤:我可以使nodejs在未處理的承諾拒絕中終止嗎?
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.
有沒有什麼辦法,使節點終止,當這些發生的呢?
代替'拋錯誤的;'也許將是很好的'process.exit(1)'。只是爲了關注將來會發生的事情,正如消息所示:'Node.js處理的非零退出代碼.' –
@DiegoZoracKy:拋出錯誤已經導致退出時出現非零代碼。它還顯示有用的信息。 – Ryan