@internxt/sdk 1.12.1 → 1.12.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.
@@ -169,7 +169,7 @@ var HttpClient = /** @class */ (function () {
169
169
  * @private
170
170
  */
171
171
  HttpClient.prototype.normalizeError = function (error) {
172
- var errorMessage, errorStatus, errorCode;
172
+ var errorMessage, errorStatus, errorCode, errorHeaders;
173
173
  if (error.response) {
174
174
  var response = error.response;
175
175
  if (response.status === 401) {
@@ -178,6 +178,7 @@ var HttpClient = /** @class */ (function () {
178
178
  errorMessage = response.data.message || response.data.error || JSON.stringify(response.data);
179
179
  errorStatus = response.status;
180
180
  errorCode = response.data.code;
181
+ errorHeaders = response.headers;
181
182
  }
182
183
  else if (error.request) {
183
184
  errorMessage = 'Server unavailable';
@@ -187,7 +188,7 @@ var HttpClient = /** @class */ (function () {
187
188
  errorMessage = error.message;
188
189
  errorStatus = 400;
189
190
  }
190
- throw new errors_1.default(errorMessage, errorStatus, errorCode);
191
+ throw new errors_1.default(errorMessage, errorStatus, errorCode, errorHeaders);
191
192
  };
192
193
  return HttpClient;
193
194
  }());
@@ -1,5 +1,6 @@
1
1
  export default class AppError extends Error {
2
2
  readonly status?: number;
3
3
  readonly code?: string;
4
- constructor(message: string, status?: number, code?: string);
4
+ readonly headers?: Record<string, string>;
5
+ constructor(message: string, status?: number, code?: string, headers?: Record<string, string>);
5
6
  }
@@ -17,10 +17,11 @@ var __extends = (this && this.__extends) || (function () {
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  var AppError = /** @class */ (function (_super) {
19
19
  __extends(AppError, _super);
20
- function AppError(message, status, code) {
20
+ function AppError(message, status, code, headers) {
21
21
  var _this = _super.call(this, message) || this;
22
22
  _this.status = status;
23
23
  _this.code = code;
24
+ _this.headers = headers;
24
25
  return _this;
25
26
  }
26
27
  return AppError;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@internxt/sdk",
3
3
  "author": "Internxt <hello@internxt.com>",
4
- "version": "1.12.1",
4
+ "version": "1.12.2",
5
5
  "description": "An sdk for interacting with Internxt's services",
6
6
  "repository": {
7
7
  "type": "git",