@ezs/basics 2.9.0 → 2.9.1
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/lib/request.js +6 -1
- package/package.json +2 -2
package/lib/request.js
CHANGED
|
@@ -6,12 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _fetchWithProxy = _interopRequireDefault(require("fetch-with-proxy"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
const request = (url, parameters) => async
|
|
9
|
+
const request = (url, parameters) => async bail => {
|
|
10
10
|
const response = await (0, _fetchWithProxy.default)(url, parameters);
|
|
11
11
|
if (!response.ok) {
|
|
12
|
+
// response.status >= 200 && response.status < 300
|
|
12
13
|
const err = new Error(response.statusText);
|
|
13
14
|
const text = await response.text();
|
|
14
15
|
err.responseText = text;
|
|
16
|
+
if ([400, 401, 402, 403, 404].indexOf(response.status) >= 0) {
|
|
17
|
+
// useless to retry
|
|
18
|
+
return bail(err);
|
|
19
|
+
}
|
|
15
20
|
throw err;
|
|
16
21
|
}
|
|
17
22
|
return response;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ezs/basics",
|
|
3
3
|
"description": "Basics statements for EZS",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.1",
|
|
5
5
|
"author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
|
|
6
6
|
"bugs": "https://github.com/Inist-CNRS/ezs/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"directories": {
|
|
36
36
|
"test": "test"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ff50bf461eed60cf72e17d7ab9fdeb5427bc5500",
|
|
39
39
|
"homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
|
|
40
40
|
"keywords": [
|
|
41
41
|
"ezs"
|