1
0
mirror of https://github.com/laurent22/joplin.git synced 2026-05-22 09:05:38 +02:00

Improved network error handling

This commit is contained in:
Laurent Cozic
2017-10-15 12:13:09 +01:00
parent 65ab55c031
commit 3d8327ae0b
7 changed files with 350 additions and 349 deletions
+8 -1
View File
@@ -8,8 +8,15 @@ function shimInit() {
shim.fs = fs;
shim.FileApiDriverLocal = FileApiDriverLocal;
shim.Geolocation = GeolocationNode;
shim.fetch = require('node-fetch');
shim.FormData = require('form-data');
const nodeFetch = require('node-fetch');
shim.fetch = function(url, options = null) {
if (!options) options = {};
if (!options.timeout) options.timeout = 1000 * 120; // ms
return nodeFetch(url, options);
}
shim.fetchBlob = async function(url, options) {
if (!options || !options.path) throw new Error('fetchBlob: target file path is missing');