Explorar o código

fixed issue when network error occurs

Gildas %!s(int64=7) %!d(string=hai) anos
pai
achega
17f05e81a8
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      lib/single-file/single-file-browser.js

+ 5 - 1
lib/single-file/single-file-browser.js

@@ -63,7 +63,11 @@ this.SingleFile = this.SingleFile || (() => {
 				return options && options.asDataURI ? "data:base64," : "";
 			}
 			if (resourceContent.status >= 400 && superFetch.hostFetch) {
-				resourceContent = await superFetch.hostFetch(resourceURL);
+				try {
+					resourceContent = await superFetch.hostFetch(resourceURL);
+				} catch (error) {
+					return options && options.asDataURI ? "data:base64," : "";
+				}
 			}
 			if (resourceContent.status >= 400) {
 				resourceContent = options && options.asDataURI ? "data:base64," : "";