电子:6.0.9
电子更新器:4.1.2
我致电autoUpdater.checkForUpdates
时电子应用程序崩溃了
没有互联网连接
应用程序甚至被尝试捕获块包围也崩溃了
try {
autoUpdater.checkForUpdates();
} catch(e) {
logEverywhere('Error, Failed to check for updates!');
}
在电子琴上运行此测试(使用autoUpdater.setFeedURL(“ https://example.com/”))
Error: Error: net::ERR_NAME_NOT_RESOLVED
(node:10144) UnhandledPromiseRejectionWarning: Error: net::ERR_NAME_NOT_RESOLVED
(node:10144) UnhandledPromiseRejectionWarning: Error: net::ERR_NAME_NOT_RESOLVED
(node:10144) 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:10144) 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:10144) [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.
(node:10144) [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.
Electron exited with code 0.
答案 0 :(得分:1)
#1
是一个异步函数,它返回一个Promise。您无法使用#2
捕获这些错误。
这是您捕获错误的方法:
autoUpdater.checkForUpdates()