@stream-io/node-sdk 0.4.1 → 0.4.2
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/dist/index.cjs.js +8 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +8 -2
- package/dist/index.es.js.map +1 -1
- package/package.json +4 -2
- package/src/BaseApi.ts +12 -3
package/dist/index.cjs.js
CHANGED
|
@@ -126,7 +126,7 @@ class BaseApi {
|
|
|
126
126
|
Authorization: this.apiConfig.token,
|
|
127
127
|
'stream-auth-type': 'jwt',
|
|
128
128
|
'Content-Type': 'application/json',
|
|
129
|
-
'X-Stream-Client': 'stream-node-' + "0.4.
|
|
129
|
+
'X-Stream-Client': 'stream-node-' + "0.4.2",
|
|
130
130
|
'Accept-Encoding': 'gzip',
|
|
131
131
|
'x-client-request-id': clientRequestId,
|
|
132
132
|
};
|
|
@@ -146,7 +146,13 @@ class BaseApi {
|
|
|
146
146
|
rateLimit: getRateLimitFromResponseHeader(responseHeaders),
|
|
147
147
|
};
|
|
148
148
|
if (response.status < 200 || response.status >= 300) {
|
|
149
|
-
|
|
149
|
+
let error;
|
|
150
|
+
try {
|
|
151
|
+
error = (yield response.json());
|
|
152
|
+
}
|
|
153
|
+
catch (_) {
|
|
154
|
+
throw new StreamError(`Stream error: ${response.status} - ${response.statusText}`, metadata, response.status);
|
|
155
|
+
}
|
|
150
156
|
throw new StreamError(`Stream error code ${error.code}: ${error.message}`, metadata, error.code, undefined);
|
|
151
157
|
}
|
|
152
158
|
const responseBody = (yield response.json());
|