@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.es.js CHANGED
@@ -124,7 +124,7 @@ class BaseApi {
124
124
  Authorization: this.apiConfig.token,
125
125
  'stream-auth-type': 'jwt',
126
126
  'Content-Type': 'application/json',
127
- 'X-Stream-Client': 'stream-node-' + "0.4.1",
127
+ 'X-Stream-Client': 'stream-node-' + "0.4.2",
128
128
  'Accept-Encoding': 'gzip',
129
129
  'x-client-request-id': clientRequestId,
130
130
  };
@@ -144,7 +144,13 @@ class BaseApi {
144
144
  rateLimit: getRateLimitFromResponseHeader(responseHeaders),
145
145
  };
146
146
  if (response.status < 200 || response.status >= 300) {
147
- const error = (yield response.json());
147
+ let error;
148
+ try {
149
+ error = (yield response.json());
150
+ }
151
+ catch (_) {
152
+ throw new StreamError(`Stream error: ${response.status} - ${response.statusText}`, metadata, response.status);
153
+ }
148
154
  throw new StreamError(`Stream error code ${error.code}: ${error.message}`, metadata, error.code, undefined);
149
155
  }
150
156
  const responseBody = (yield response.json());