Browse Source

refactor: handle uncaught promise error (#35484)

daief 2 years ago
parent
commit
ff4816367e
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lib/renderer/web-view/web-view-attributes.ts

+ 4 - 1
lib/renderer/web-view/web-view-attributes.ts

@@ -186,7 +186,10 @@ export class SrcAttribute extends WebViewAttribute {
       opts.userAgent = useragent;
     }
 
-    (this.webViewImpl.webviewNode as Electron.WebviewTag).loadURL(this.getValue(), opts);
+    (this.webViewImpl.webviewNode as Electron.WebviewTag).loadURL(this.getValue(), opts)
+      .catch(err => {
+        console.error('Unexpected error while loading URL', err);
+      });
   }
 }