forked from hibas123/SecureFileWrapper
Adding better noConnection handling
This commit is contained in:
parent
709c4646ca
commit
1cb87b051c
5
index.js
5
index.js
@ -127,7 +127,10 @@ var SecureFile = /** @class */ (function () {
|
|||||||
return [2 /*return*/, res];
|
return [2 /*return*/, res];
|
||||||
case 4:
|
case 4:
|
||||||
err_2 = _a.sent();
|
err_2 = _a.sent();
|
||||||
throw new NoConnection();
|
if (err_2 instanceof TypeError || err_2.errno === "ECONNREFUSED")
|
||||||
|
throw new NoConnection();
|
||||||
|
console.log(err_2);
|
||||||
|
throw err_2;
|
||||||
case 5: return [2 /*return*/];
|
case 5: return [2 /*return*/];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
5
index.ts
5
index.ts
@ -72,7 +72,10 @@ export default class SecureFile {
|
|||||||
let res = await fetch(this.Server + endpoint + query_str, { method: method, body: body, headers: myHeaders });
|
let res = await fetch(this.Server + endpoint + query_str, { method: method, body: body, headers: myHeaders });
|
||||||
return res;
|
return res;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new NoConnection();
|
if (err instanceof TypeError || err.errno === "ECONNREFUSED")
|
||||||
|
throw new NoConnection();
|
||||||
|
console.log(err);
|
||||||
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "secure-file-wrapper",
|
"name": "secure-file-wrapper",
|
||||||
"version": "1.0.10",
|
"version": "1.0.11",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
"author": "Fabian Stamm <dev@fabianstamm.de>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user