@nexrender/core 1.60.5 → 1.60.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexrender/core",
3
- "version": "1.60.5",
3
+ "version": "1.60.8",
4
4
  "main": "src/index.js",
5
5
  "author": "Inlife",
6
6
  "homepage": "https://www.nexrender.com",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "5ab029fe67966f2cd481c1d4adb3b076513525b8"
46
+ "gitHead": "1b3b8e478c96f2e8dc66d918b5f1a9aee2258fc2"
47
47
  }
@@ -88,7 +88,7 @@ const download = (job, settings, asset) => {
88
88
 
89
89
  /* TODO: maybe move to external package ?? */
90
90
  const src = asset.src
91
- return withTimeout(fetch(src, asset.params), NEXRENDER_DOWNLOAD_TIMEOUT, 'Download timed out')
91
+ return fetch(src, asset.params)
92
92
  .then(res => res.ok ? res : Promise.reject(new Error(`Unable to download file ${src}`)))
93
93
  .then(res => {
94
94
  // Set a file extension based on content-type header if not already set
@@ -107,9 +107,9 @@ const download = (job, settings, asset) => {
107
107
 
108
108
  const stream = fs.createWriteStream(asset.dest)
109
109
 
110
- return new Promise((resolve, reject) => {
110
+ return withTimeout(new Promise((resolve, reject) => {
111
111
  const errorHandler = (error) => {
112
- reject(new Error({reason: 'Unable to download file', meta: {src, error}}))
112
+ reject(new Error('Unable to download file ' + asset.src + ' due to ' + error))
113
113
  };
114
114
 
115
115
  res.body
@@ -119,7 +119,7 @@ const download = (job, settings, asset) => {
119
119
  stream
120
120
  .on('error', errorHandler)
121
121
  .on('finish', resolve)
122
- })
122
+ }), NEXRENDER_DOWNLOAD_TIMEOUT, 'Download timed out for asset ' + asset.src)
123
123
  });
124
124
 
125
125
  case 'file':