@ezs/basics 1.15.4 → 1.15.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.15.5](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.4...@ezs/basics@1.15.5) (2022-02-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * 🐛 improve warning debug message on error ([5ff32e8](https://github.com/Inist-CNRS/ezs/commit/5ff32e8e2e6c48913d8d1abd35b9cee68ff19be4))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [1.15.4](https://github.com/Inist-CNRS/ezs/compare/@ezs/basics@1.15.3...@ezs/basics@1.15.4) (2022-01-31)
7
18
 
8
19
 
@@ -50,6 +50,7 @@ function URLConnect(data, feed) {
50
50
  method: 'POST',
51
51
  body: this.input.pipe(ezs('dump')).pipe(ezs.toBuffer()),
52
52
  timeout,
53
+ headers,
53
54
  signal: controller.signal
54
55
  }).then(({
55
56
  body,
@@ -70,6 +71,7 @@ function URLConnect(data, feed) {
70
71
  this.whenFinish = Promise.resolve(true);
71
72
 
72
73
  if (!noerror) {
74
+ (0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLConnect] <${e}>`);
73
75
  feed.stop(e);
74
76
  } else {
75
77
  (0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLConnect] <${e}>`);
package/lib/url-fetch.js CHANGED
@@ -64,6 +64,12 @@ async function URLFetch(data, feed) {
64
64
 
65
65
  try {
66
66
  const response = await (0, _fetchWithProxy.default)(url, parameters);
67
+
68
+ if (!response.ok) {
69
+ const msg = `Received status code ${response.status} (${response.statusText})`;
70
+ throw new Error(msg);
71
+ }
72
+
67
73
  const func = json ? 'json' : 'text';
68
74
  const value = await response[func]();
69
75
 
@@ -79,10 +85,11 @@ async function URLFetch(data, feed) {
79
85
  controller.abort();
80
86
 
81
87
  if (noerror) {
88
+ (0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLFetch] <${e}>`);
82
89
  return feed.send(data);
83
90
  }
84
91
 
85
- (0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLConnect] <${e}>`);
92
+ (0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLFetch] <${e}>`);
86
93
  return feed.send(e);
87
94
  }
88
95
  }
package/lib/url-stream.js CHANGED
@@ -103,12 +103,12 @@ async function URLStream(data, feed) {
103
103
 
104
104
  try {
105
105
  const response = await (0, _fetchWithProxy.default)(cURL.href, {
106
- headers,
107
106
  timeout,
107
+ headers,
108
108
  signal: controller.signal
109
109
  });
110
110
 
111
- if (response.status !== 200) {
111
+ if (!response.ok) {
112
112
  const msg = `Received status code ${response.status} (${response.statusText})`;
113
113
  throw new Error(msg);
114
114
  }
@@ -120,10 +120,11 @@ async function URLStream(data, feed) {
120
120
  controller.abort();
121
121
 
122
122
  if (noerror) {
123
+ (0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLStream] <${e}>`);
123
124
  return feed.send(data);
124
125
  }
125
126
 
126
- (0, _debug.default)('ezs')(`Ignore item #${this.getIndex()} [URLConnect] <${e}>`);
127
+ (0, _debug.default)('ezs')(`Break item #${this.getIndex()} [URLStream] <${e}>`);
127
128
  return feed.send(e);
128
129
  }
129
130
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ezs/basics",
3
3
  "description": "Basics statements for EZS",
4
- "version": "1.15.4",
4
+ "version": "1.15.5",
5
5
  "author": "Nicolas Thouvenin <nthouvenin@gmail.com>",
6
6
  "bugs": "https://github.com/Inist-CNRS/ezs/issues",
7
7
  "dependencies": {
@@ -33,7 +33,7 @@
33
33
  "directories": {
34
34
  "test": "test"
35
35
  },
36
- "gitHead": "653a28a1e40b088ea62b1b00c055de51e264dee1",
36
+ "gitHead": "c428e447199c38dd527d94df7f2f08a3aa72b405",
37
37
  "homepage": "https://github.com/Inist-CNRS/ezs/tree/master/packages/basics#readme",
38
38
  "keywords": [
39
39
  "ezs"