Browse Source

refactor: handle uncaught promise error (#36158)

Co-authored-by: daief <[email protected]>

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: daief <[email protected]>
trop[bot] 2 years ago
parent
commit
fa9ffa77b8
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);
+      });
   }
 }