testaro 51.0.2 → 51.0.3
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/netWatch.js +12 -1
- package/package.json +1 -1
package/netWatch.js
CHANGED
|
@@ -209,6 +209,8 @@ exports.netWatch = async (isForever, intervalInSeconds, isCertTolerant = true) =
|
|
|
209
209
|
}
|
|
210
210
|
// Otherwise, i.e. if it is not JSON:
|
|
211
211
|
catch(error) {
|
|
212
|
+
// Abort the watch.
|
|
213
|
+
abort = true;
|
|
212
214
|
// Report it.
|
|
213
215
|
console.log(
|
|
214
216
|
`ERROR: ${reportLogStart}status ${repResponse.statusCode}, error message ${error.message}, and response ${content.slice(0, 1000)}\n`
|
|
@@ -222,6 +224,8 @@ exports.netWatch = async (isForever, intervalInSeconds, isCertTolerant = true) =
|
|
|
222
224
|
})
|
|
223
225
|
// If the report submission throws an error:
|
|
224
226
|
.on('error', async error => {
|
|
227
|
+
// Abort the watch.
|
|
228
|
+
abort = true;
|
|
225
229
|
// Report this.
|
|
226
230
|
console.log(
|
|
227
231
|
`ERROR ${error.code} in report submission: ${reportLogStart}error message ${error.message}\n`
|
|
@@ -241,6 +245,8 @@ exports.netWatch = async (isForever, intervalInSeconds, isCertTolerant = true) =
|
|
|
241
245
|
}
|
|
242
246
|
// Otherwise, i.e. if it is not JSON:
|
|
243
247
|
catch(error) {
|
|
248
|
+
// Abort the watch.
|
|
249
|
+
abort = true;
|
|
244
250
|
// Report this.
|
|
245
251
|
console.log(`ERROR: Job request got non-JSON response (${error.message})`);
|
|
246
252
|
resolve(true);
|
|
@@ -251,11 +257,15 @@ exports.netWatch = async (isForever, intervalInSeconds, isCertTolerant = true) =
|
|
|
251
257
|
.on('error', async error => {
|
|
252
258
|
// If it is a refusal to connect:
|
|
253
259
|
if (error.code && error.code.includes('ECONNREFUSED')) {
|
|
260
|
+
// Abort the watch.
|
|
261
|
+
abort = true;
|
|
254
262
|
// Report this.
|
|
255
263
|
console.log(`${logStart}no connection`);
|
|
256
264
|
}
|
|
257
265
|
// Otherwise, if it was a DNS failure:
|
|
258
266
|
else if (error.code && error.code.includes('ENOTFOUND')) {
|
|
267
|
+
// Abort the watch.
|
|
268
|
+
abort = true;
|
|
259
269
|
// Report this.
|
|
260
270
|
console.log(`${logStart}no domain name resolution`);
|
|
261
271
|
}
|
|
@@ -280,9 +290,10 @@ exports.netWatch = async (isForever, intervalInSeconds, isCertTolerant = true) =
|
|
|
280
290
|
}
|
|
281
291
|
// If requesting a job throws an error:
|
|
282
292
|
catch(error) {
|
|
293
|
+
// Abort the watch.
|
|
294
|
+
abort = true;
|
|
283
295
|
// Report this.
|
|
284
296
|
console.log(`ERROR requesting a network job (${error.message})`);
|
|
285
|
-
abort = true;
|
|
286
297
|
resolve(true);
|
|
287
298
|
}
|
|
288
299
|
});
|