@voiceflow/exception 1.5.4 → 1.6.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.
Files changed (44) hide show
  1. package/README.md +8 -2
  2. package/build/cjs/base-error.interface.d.ts +1 -1
  3. package/build/cjs/base-error.interface.d.ts.map +1 -1
  4. package/build/cjs/client.exception.d.ts +3 -3
  5. package/build/cjs/client.exception.d.ts.map +1 -1
  6. package/build/cjs/client.exception.js +3 -3
  7. package/build/cjs/error-code.enum.js +1 -1
  8. package/build/cjs/error-message.interface.d.ts +2 -2
  9. package/build/cjs/error-message.interface.d.ts.map +1 -1
  10. package/build/cjs/error-payload.interface.d.ts +1 -1
  11. package/build/cjs/error-payload.interface.d.ts.map +1 -1
  12. package/build/cjs/http/http-4xx.exception.d.ts.map +1 -1
  13. package/build/cjs/http/http-5xx.exception.d.ts.map +1 -1
  14. package/build/cjs/http/http-status.enum.js +1 -1
  15. package/build/cjs/http/http.exception.d.ts +2 -2
  16. package/build/cjs/http/http.exception.d.ts.map +1 -1
  17. package/build/cjs/http/http.exception.js +7 -7
  18. package/build/cjs/http/utils.d.ts +2 -2
  19. package/build/cjs/http/utils.d.ts.map +1 -1
  20. package/build/cjs/http/utils.js +3 -1
  21. package/build/cjs/internal.exception.d.ts +4 -4
  22. package/build/cjs/internal.exception.d.ts.map +1 -1
  23. package/build/cjs/internal.exception.js +11 -11
  24. package/build/esm/base-error.interface.d.ts +1 -1
  25. package/build/esm/base-error.interface.d.ts.map +1 -1
  26. package/build/esm/client.exception.d.ts +3 -3
  27. package/build/esm/client.exception.d.ts.map +1 -1
  28. package/build/esm/client.exception.js +3 -3
  29. package/build/esm/error-message.interface.d.ts +2 -2
  30. package/build/esm/error-message.interface.d.ts.map +1 -1
  31. package/build/esm/error-payload.interface.d.ts +1 -1
  32. package/build/esm/error-payload.interface.d.ts.map +1 -1
  33. package/build/esm/http/http-4xx.exception.d.ts.map +1 -1
  34. package/build/esm/http/http-5xx.exception.d.ts.map +1 -1
  35. package/build/esm/http/http.exception.d.ts +2 -2
  36. package/build/esm/http/http.exception.d.ts.map +1 -1
  37. package/build/esm/http/http.exception.js +7 -7
  38. package/build/esm/http/utils.d.ts +2 -2
  39. package/build/esm/http/utils.d.ts.map +1 -1
  40. package/build/esm/http/utils.js +3 -1
  41. package/build/esm/internal.exception.d.ts +4 -4
  42. package/build/esm/internal.exception.d.ts.map +1 -1
  43. package/build/esm/internal.exception.js +11 -11
  44. package/package.json +28 -34
package/README.md CHANGED
@@ -18,7 +18,13 @@ These exceptions are meant to be caught and transformed by express middleware or
18
18
  Named exceptions exist for all standard HTTP 4xx and 5xx error codes.
19
19
 
20
20
  ```ts
21
- import { ErrorCode, BadRequestException, NotFoundException, InternalServerErrorException, BadGatewayException } from '@voiceflow/exception';
21
+ import {
22
+ ErrorCode,
23
+ BadRequestException,
24
+ NotFoundException,
25
+ InternalServerErrorException,
26
+ BadGatewayException,
27
+ } from '@voiceflow/exception';
22
28
 
23
29
  // default error message
24
30
  throw new BadRequestException();
@@ -31,7 +37,7 @@ throw new BadGatewayException({ message: 'request timed out', errorCode: ErrorCo
31
37
 
32
38
  try {
33
39
  // do something
34
- } catch (err) {
40
+ } catch (err) {
35
41
  // wrap internal error
36
42
  throw new InternalServerErrorException({ message: 'implementation error', cause: err });
37
43
  }
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from './error-code.enum';
1
+ import type { ErrorCode } from './error-code.enum';
2
2
  export interface BaseError {
3
3
  /**
4
4
  * message describing this error
@@ -1 +1 @@
1
- {"version":3,"file":"base-error.interface.d.ts","sourceRoot":"","sources":["../../src/base-error.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
1
+ {"version":3,"file":"base-error.interface.d.ts","sourceRoot":"","sources":["../../src/base-error.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
@@ -1,6 +1,6 @@
1
- import { BaseResponse } from './base-response.interface';
2
- import { ErrorCode } from './error-code.enum';
3
- import { ErrorPayload } from './error-payload.interface';
1
+ import type { BaseResponse } from './base-response.interface';
2
+ import type { ErrorCode } from './error-code.enum';
3
+ import type { ErrorPayload } from './error-payload.interface';
4
4
  export declare class ClientException<Res extends BaseResponse = BaseResponse> extends Error implements ErrorPayload {
5
5
  static instanceOf(err: any): err is ClientException;
6
6
  response: Res;
@@ -1 +1 @@
1
- {"version":3,"file":"client.exception.d.ts","sourceRoot":"","sources":["../../src/client.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,qBAAa,eAAe,CAAC,GAAG,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,KAAM,YAAW,YAAY;WAC3F,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe;IAInD,QAAQ,EAAE,GAAG,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,QAAQ,EAAE,GAAG;IAQzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,kBAAkB;IAInB,QAAQ;IAIF,KAAK;IAYX,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE"}
1
+ {"version":3,"file":"client.exception.d.ts","sourceRoot":"","sources":["../../src/client.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qBAAa,eAAe,CAAC,GAAG,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,KAAM,YAAW,YAAY;WAC3F,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe;IAInD,QAAQ,EAAE,GAAG,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,QAAQ,EAAE,GAAG;IAQzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,kBAAkB;IAInB,QAAQ;IAIF,KAAK;IAYX,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE"}
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ClientException = void 0;
4
4
  class ClientException extends Error {
5
+ static instanceOf(err) {
6
+ return err instanceof ClientException;
7
+ }
5
8
  constructor(response) {
6
9
  super();
7
10
  this.name = this.constructor.name;
@@ -9,9 +12,6 @@ class ClientException extends Error {
9
12
  this.statusCode = response.status;
10
13
  this.statusText = response.statusText;
11
14
  }
12
- static instanceOf(err) {
13
- return err instanceof ClientException;
14
- }
15
15
  extractDetailedError(body) {
16
16
  this.message = body.message || this.response.statusText;
17
17
  if (body.cause)
@@ -7,4 +7,4 @@ var ErrorCode;
7
7
  ErrorCode["INTEGRATION_RESOURCE_NOT_FOUND"] = "INTEGRATION_RESOURCE_NOT_FOUND";
8
8
  ErrorCode["BILLING_QUOTA_EXCEEDED"] = "BILLING_QUOTA_EXCEEDED";
9
9
  ErrorCode["BILLING_PLAN_NOT_ALLOWED"] = "BILLING_PLAN_NOT_ALLOWED";
10
- })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
10
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
@@ -1,6 +1,6 @@
1
- import { BaseError } from './base-error.interface';
1
+ import type { BaseError } from './base-error.interface';
2
2
  export interface DetailedErrorMessage extends BaseError {
3
3
  cause?: unknown;
4
4
  }
5
- export declare type ErrorMessage = string | Error | DetailedErrorMessage;
5
+ export type ErrorMessage = string | Error | DetailedErrorMessage;
6
6
  //# sourceMappingURL=error-message.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-message.interface.d.ts","sourceRoot":"","sources":["../../src/error-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,oBAAY,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"error-message.interface.d.ts","sourceRoot":"","sources":["../../src/error-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { BaseError } from './base-error.interface';
1
+ import type { BaseError } from './base-error.interface';
2
2
  export interface ErrorPayload extends BaseError {
3
3
  /**
4
4
  * standard HTTP status code
@@ -1 +1 @@
1
- {"version":3,"file":"error-payload.interface.d.ts","sourceRoot":"","sources":["../../src/error-payload.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"error-payload.interface.d.ts","sourceRoot":"","sources":["../../src/error-payload.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"http-4xx.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http-4xx.exception.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAC9F,eAAO,MAAM,qBAAqB,sCAA+D,CAAC;AAClG,eAAO,MAAM,wBAAwB,sCAAuE,CAAC;AAC7G,eAAO,MAAM,kBAAkB,sCAAyD,CAAC;AACzF,eAAO,MAAM,iBAAiB,sCAAyD,CAAC;AACxF,eAAO,MAAM,yBAAyB,sCAA2E,CAAC;AAClH,eAAO,MAAM,sBAAsB,sCAAmE,CAAC;AACvG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AAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,gCAAgC,sCAA2F,CAAC;AACzI,eAAO,MAAM,8BAA8B,sCAAqF,CAAC;AACjI,eAAO,MAAM,4BAA4B,sCAA+E,CAAC;AACzH,eAAO,MAAM,qBAAqB,sCAAiE,CAAC;AACpG,eAAO,MAAM,oBAAoB,sCAA+D,CAAC;AACjG,eAAO,MAAM,sCAAsC,sCAGlD,CAAC"}
1
+ {"version":3,"file":"http-5xx.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http-5xx.exception.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,sCAGxC,CAAC;AACF,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAC9F,eAAO,MAAM,2BAA2B,sCAA6E,CAAC;AACtH,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,gCAAgC,sCAG5C,CAAC;AACF,eAAO,MAAM,8BAA8B,sCAG1C,CAAC;AACF,eAAO,MAAM,4BAA4B,sCAGxC,CAAC;AACF,eAAO,MAAM,qBAAqB,sCAAiE,CAAC;AACpG,eAAO,MAAM,oBAAoB,sCAA+D,CAAC;AACjG,eAAO,MAAM,sCAAsC,sCAGlD,CAAC"}
@@ -45,4 +45,4 @@ var HTTPStatus;
45
45
  HTTPStatus[HTTPStatus["LOOP_DETECTED"] = 508] = "LOOP_DETECTED";
46
46
  HTTPStatus[HTTPStatus["NOT_EXTENDED"] = 510] = "NOT_EXTENDED";
47
47
  HTTPStatus[HTTPStatus["NETWORK_AUTHENTICATION_REQUIRED"] = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
48
- })(HTTPStatus = exports.HTTPStatus || (exports.HTTPStatus = {}));
48
+ })(HTTPStatus || (exports.HTTPStatus = HTTPStatus = {}));
@@ -1,5 +1,5 @@
1
- import { ErrorMessage } from '../error-message.interface';
2
- import { ErrorPayload } from '../error-payload.interface';
1
+ import type { ErrorMessage } from '../error-message.interface';
2
+ import type { ErrorPayload } from '../error-payload.interface';
3
3
  import { InternalException } from '../internal.exception';
4
4
  export interface SerializedHTTPException {
5
5
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"http.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,uBAAuB;WACvE,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa;IAIxD,OAAO,CAAC,MAAM,CAAC,qBAAqB;WAItB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB;IASzE,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,YAAY,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,YAAyB;IAQ3E,cAAc,IAAI,YAAY;CAatC"}
1
+ {"version":3,"file":"http.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,uBAAuB;WACvE,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa;IAIxD,OAAO,CAAC,MAAM,CAAC,qBAAqB;WAItB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB;IASzE,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,YAAY,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,YAAyB;IAQ3E,cAAc,IAAI,YAAY;CAatC"}
@@ -3,13 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HTTPException = void 0;
4
4
  const internal_exception_1 = require("../internal.exception");
5
5
  class HTTPException extends internal_exception_1.InternalException {
6
- constructor(statusCode, statusText, msg = statusText) {
7
- super(msg);
8
- this.message ||= statusText;
9
- this.statusCode = statusCode;
10
- this.statusText = statusText;
11
- this.response = this.createResponse();
12
- }
13
6
  static instanceOf(err) {
14
7
  return err instanceof HTTPException;
15
8
  }
@@ -22,6 +15,13 @@ class HTTPException extends internal_exception_1.InternalException {
22
15
  typeof err.message === 'string' &&
23
16
  typeof err.statusCode === 'number');
24
17
  }
18
+ constructor(statusCode, statusText, msg = statusText) {
19
+ super(msg);
20
+ this.message ||= statusText;
21
+ this.statusCode = statusCode;
22
+ this.statusText = statusText;
23
+ this.response = this.createResponse();
24
+ }
25
25
  createResponse() {
26
26
  const cause = this.getCause();
27
27
  return {
@@ -1,6 +1,6 @@
1
- import { ErrorMessage } from '../error-message.interface';
1
+ import type { ErrorMessage } from '../error-message.interface';
2
2
  import { HTTPException } from './http.exception';
3
- import { HTTPStatus } from './http-status.enum';
3
+ import type { HTTPStatus } from './http-status.enum';
4
4
  export interface HTTPExceptionClass {
5
5
  new (message?: ErrorMessage): HTTPException;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/http/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,MAAM,WAAW,kBAAkB;IACjC,KAAK,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,eAAgB,UAAU,cAAc,MAAM,KAAG,kBAUhF,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/http/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,MAAM,WAAW,kBAAkB;IACjC,KAAK,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,eAAgB,UAAU,cAAc,MAAM,KAAG,kBAYhF,CAAC"}
@@ -9,7 +9,9 @@ const createHTTPException = (statusCode, statusText) => {
9
9
  super(statusCode, statusText, message);
10
10
  }
11
11
  }
12
- Object.defineProperty(NamedHTTPException, 'name', { value: `${statusText.replace(WHITESPACE_PATTERN, '')}Exception` });
12
+ Object.defineProperty(NamedHTTPException, 'name', {
13
+ value: `${statusText.replace(WHITESPACE_PATTERN, '')}Exception`,
14
+ });
13
15
  return NamedHTTPException;
14
16
  };
15
17
  exports.createHTTPException = createHTTPException;
@@ -1,7 +1,7 @@
1
- import { BaseError } from './base-error.interface';
2
- import { ErrorCode } from './error-code.enum';
3
- import { ErrorMessage } from './error-message.interface';
4
- declare type UndefinedPartial<T> = {
1
+ import type { BaseError } from './base-error.interface';
2
+ import type { ErrorCode } from './error-code.enum';
3
+ import type { ErrorMessage } from './error-message.interface';
4
+ type UndefinedPartial<T> = {
5
5
  [K in keyof T]?: T[K] | undefined;
6
6
  };
7
7
  export declare class InternalException extends Error implements BaseError {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.exception.d.ts","sourceRoot":"","sources":["../../src/internal.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,aAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAClC,CAAC;AAOF,qBAAa,iBAAkB,SAAQ,KAAM,YAAW,SAAS;WACjD,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB;WAI9C,WAAW,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,SAAS;IAiCnE,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEvB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,GAAG,CAAC,EAAE,YAAY;IAUvB,QAAQ;IAMR,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE;AAGD,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,SAAU,SAAQ,gBAAgB,CAAC,SAAS,CAAC;QAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;KACpC;CACF"}
1
+ {"version":3,"file":"internal.exception.d.ts","sourceRoot":"","sources":["../../src/internal.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAClC,CAAC;AAQF,qBAAa,iBAAkB,SAAQ,KAAM,YAAW,SAAS;WACjD,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB;WAI9C,WAAW,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,SAAS;IAiCnE,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEvB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,GAAG,CAAC,EAAE,YAAY;IAUvB,QAAQ;IAMR,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE;AAGD,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,SAAU,SAAQ,gBAAgB,CAAC,SAAS,CAAC;QAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;KACpC;CACF"}
@@ -6,17 +6,6 @@ const isObject = (value) => !!value && typeof value === 'object';
6
6
  const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
7
7
  const isErrorLike = (error) => isObject(error) && hasProperty(error, 'message') && typeof error.message === 'string';
8
8
  class InternalException extends Error {
9
- constructor(msg) {
10
- const data = InternalException.extractData(msg);
11
- super(data.message);
12
- this.name = this.constructor.name;
13
- if (data.details)
14
- this.details = data.details;
15
- if (data.errorCode)
16
- this.errorCode = data.errorCode;
17
- if (data.cause)
18
- this.cause = data.cause;
19
- }
20
9
  static instanceOf(err) {
21
10
  return err instanceof InternalException;
22
11
  }
@@ -53,6 +42,17 @@ class InternalException extends Error {
53
42
  cause,
54
43
  };
55
44
  }
45
+ constructor(msg) {
46
+ const data = InternalException.extractData(msg);
47
+ super(data.message);
48
+ this.name = this.constructor.name;
49
+ if (data.details)
50
+ this.details = data.details;
51
+ if (data.errorCode)
52
+ this.errorCode = data.errorCode;
53
+ if (data.cause)
54
+ this.cause = data.cause;
55
+ }
56
56
  getCause() {
57
57
  if (typeof this.cause === 'string')
58
58
  return this.cause;
@@ -1,4 +1,4 @@
1
- import { ErrorCode } from './error-code.enum.js';
1
+ import type { ErrorCode } from './error-code.enum.js';
2
2
  export interface BaseError {
3
3
  /**
4
4
  * message describing this error
@@ -1 +1 @@
1
- {"version":3,"file":"base-error.interface.d.ts","sourceRoot":"","sources":["../../src/base-error.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
1
+ {"version":3,"file":"base-error.interface.d.ts","sourceRoot":"","sources":["../../src/base-error.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB"}
@@ -1,6 +1,6 @@
1
- import { BaseResponse } from './base-response.interface.js';
2
- import { ErrorCode } from './error-code.enum.js';
3
- import { ErrorPayload } from './error-payload.interface.js';
1
+ import type { BaseResponse } from './base-response.interface.js';
2
+ import type { ErrorCode } from './error-code.enum.js';
3
+ import type { ErrorPayload } from './error-payload.interface.js';
4
4
  export declare class ClientException<Res extends BaseResponse = BaseResponse> extends Error implements ErrorPayload {
5
5
  static instanceOf(err: any): err is ClientException;
6
6
  response: Res;
@@ -1 +1 @@
1
- {"version":3,"file":"client.exception.d.ts","sourceRoot":"","sources":["../../src/client.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,qBAAa,eAAe,CAAC,GAAG,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,KAAM,YAAW,YAAY;WAC3F,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe;IAInD,QAAQ,EAAE,GAAG,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,QAAQ,EAAE,GAAG;IAQzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,kBAAkB;IAInB,QAAQ;IAIF,KAAK;IAYX,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE"}
1
+ {"version":3,"file":"client.exception.d.ts","sourceRoot":"","sources":["../../src/client.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,qBAAa,eAAe,CAAC,GAAG,SAAS,YAAY,GAAG,YAAY,CAAE,SAAQ,KAAM,YAAW,YAAY;WAC3F,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,eAAe;IAInD,QAAQ,EAAE,GAAG,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,QAAQ,EAAE,GAAG;IAQzB,OAAO,CAAC,oBAAoB;IAO5B,OAAO,CAAC,kBAAkB;IAInB,QAAQ;IAIF,KAAK;IAYX,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE"}
@@ -1,4 +1,7 @@
1
1
  export class ClientException extends Error {
2
+ static instanceOf(err) {
3
+ return err instanceof ClientException;
4
+ }
2
5
  constructor(response) {
3
6
  super();
4
7
  this.name = this.constructor.name;
@@ -6,9 +9,6 @@ export class ClientException extends Error {
6
9
  this.statusCode = response.status;
7
10
  this.statusText = response.statusText;
8
11
  }
9
- static instanceOf(err) {
10
- return err instanceof ClientException;
11
- }
12
12
  extractDetailedError(body) {
13
13
  this.message = body.message || this.response.statusText;
14
14
  if (body.cause)
@@ -1,6 +1,6 @@
1
- import { BaseError } from './base-error.interface.js';
1
+ import type { BaseError } from './base-error.interface.js';
2
2
  export interface DetailedErrorMessage extends BaseError {
3
3
  cause?: unknown;
4
4
  }
5
- export declare type ErrorMessage = string | Error | DetailedErrorMessage;
5
+ export type ErrorMessage = string | Error | DetailedErrorMessage;
6
6
  //# sourceMappingURL=error-message.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-message.interface.d.ts","sourceRoot":"","sources":["../../src/error-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,oBAAY,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,CAAC"}
1
+ {"version":3,"file":"error-message.interface.d.ts","sourceRoot":"","sources":["../../src/error-message.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,oBAAoB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { BaseError } from './base-error.interface.js';
1
+ import type { BaseError } from './base-error.interface.js';
2
2
  export interface ErrorPayload extends BaseError {
3
3
  /**
4
4
  * standard HTTP status code
@@ -1 +1 @@
1
- {"version":3,"file":"error-payload.interface.d.ts","sourceRoot":"","sources":["../../src/error-payload.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"error-payload.interface.d.ts","sourceRoot":"","sources":["../../src/error-payload.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;OAEG;IACH,UAAU,EAAE,MA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,CAAC;AACxF,eAAO,MAAM,wBAAwB,sCAAuE,CAAC;AAC7G,eAAO,MAAM,6BAA6B,sCAGzC,CAAC;AACF,eAAO,MAAM,wBAAwB,sCAAyE,CAAC;AAC/G,eAAO,MAAM,oCAAoC,sCAGhD,CAAC;AACF,eAAO,MAAM,mCAAmC,sCAG/C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"http-5xx.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http-5xx.exception.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,sCAAiF,CAAC;AAC3H,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAC9F,eAAO,MAAM,2BAA2B,sCAA6E,CAAC;AACtH,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,gCAAgC,sCAA2F,CAAC;AACzI,eAAO,MAAM,8BAA8B,sCAAqF,CAAC;AACjI,eAAO,MAAM,4BAA4B,sCAA+E,CAAC;AACzH,eAAO,MAAM,qBAAqB,sCAAiE,CAAC;AACpG,eAAO,MAAM,oBAAoB,sCAA+D,CAAC;AACjG,eAAO,MAAM,sCAAsC,sCAGlD,CAAC"}
1
+ {"version":3,"file":"http-5xx.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http-5xx.exception.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,sCAGxC,CAAC;AACF,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAC9F,eAAO,MAAM,2BAA2B,sCAA6E,CAAC;AACtH,eAAO,MAAM,uBAAuB,sCAAqE,CAAC;AAC1G,eAAO,MAAM,gCAAgC,sCAG5C,CAAC;AACF,eAAO,MAAM,8BAA8B,sCAG1C,CAAC;AACF,eAAO,MAAM,4BAA4B,sCAGxC,CAAC;AACF,eAAO,MAAM,qBAAqB,sCAAiE,CAAC;AACpG,eAAO,MAAM,oBAAoB,sCAA+D,CAAC;AACjG,eAAO,MAAM,sCAAsC,sCAGlD,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ErrorMessage } from '../error-message.interface.js';
2
- import { ErrorPayload } from '../error-payload.interface.js';
1
+ import type { ErrorMessage } from '../error-message.interface.js';
2
+ import type { ErrorPayload } from '../error-payload.interface.js';
3
3
  import { InternalException } from '../internal.exception.js';
4
4
  export interface SerializedHTTPException {
5
5
  message: string;
@@ -1 +1 @@
1
- {"version":3,"file":"http.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,uBAAuB;WACvE,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa;IAIxD,OAAO,CAAC,MAAM,CAAC,qBAAqB;WAItB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB;IASzE,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,YAAY,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,YAAyB;IAQ3E,cAAc,IAAI,YAAY;CAatC"}
1
+ {"version":3,"file":"http.exception.d.ts","sourceRoot":"","sources":["../../../src/http/http.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,iBAAkB,YAAW,uBAAuB;WACvE,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,aAAa;IAIxD,OAAO,CAAC,MAAM,CAAC,qBAAqB;WAItB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,uBAAuB;IASzE,UAAU,EAAE,MAAM,CAAC;IAEnB,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,YAAY,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,YAAyB;IAQ3E,cAAc,IAAI,YAAY;CAatC"}
@@ -1,12 +1,5 @@
1
1
  import { InternalException } from '../internal.exception.js';
2
2
  export class HTTPException extends InternalException {
3
- constructor(statusCode, statusText, msg = statusText) {
4
- super(msg);
5
- this.message ||= statusText;
6
- this.statusCode = statusCode;
7
- this.statusText = statusText;
8
- this.response = this.createResponse();
9
- }
10
3
  static instanceOf(err) {
11
4
  return err instanceof HTTPException;
12
5
  }
@@ -19,6 +12,13 @@ export class HTTPException extends InternalException {
19
12
  typeof err.message === 'string' &&
20
13
  typeof err.statusCode === 'number');
21
14
  }
15
+ constructor(statusCode, statusText, msg = statusText) {
16
+ super(msg);
17
+ this.message ||= statusText;
18
+ this.statusCode = statusCode;
19
+ this.statusText = statusText;
20
+ this.response = this.createResponse();
21
+ }
22
22
  createResponse() {
23
23
  const cause = this.getCause();
24
24
  return {
@@ -1,6 +1,6 @@
1
- import { ErrorMessage } from '../error-message.interface.js';
1
+ import type { ErrorMessage } from '../error-message.interface.js';
2
2
  import { HTTPException } from './http.exception.js';
3
- import { HTTPStatus } from './http-status.enum.js';
3
+ import type { HTTPStatus } from './http-status.enum.js';
4
4
  export interface HTTPExceptionClass {
5
5
  new (message?: ErrorMessage): HTTPException;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/http/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,MAAM,WAAW,kBAAkB;IACjC,KAAK,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,eAAgB,UAAU,cAAc,MAAM,KAAG,kBAUhF,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/http/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIrD,MAAM,WAAW,kBAAkB;IACjC,KAAK,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;CAC7C;AAED,eAAO,MAAM,mBAAmB,eAAgB,UAAU,cAAc,MAAM,KAAG,kBAYhF,CAAC"}
@@ -6,6 +6,8 @@ export const createHTTPException = (statusCode, statusText) => {
6
6
  super(statusCode, statusText, message);
7
7
  }
8
8
  }
9
- Object.defineProperty(NamedHTTPException, 'name', { value: `${statusText.replace(WHITESPACE_PATTERN, '')}Exception` });
9
+ Object.defineProperty(NamedHTTPException, 'name', {
10
+ value: `${statusText.replace(WHITESPACE_PATTERN, '')}Exception`,
11
+ });
10
12
  return NamedHTTPException;
11
13
  };
@@ -1,7 +1,7 @@
1
- import { BaseError } from './base-error.interface.js';
2
- import { ErrorCode } from './error-code.enum.js';
3
- import { ErrorMessage } from './error-message.interface.js';
4
- declare type UndefinedPartial<T> = {
1
+ import type { BaseError } from './base-error.interface.js';
2
+ import type { ErrorCode } from './error-code.enum.js';
3
+ import type { ErrorMessage } from './error-message.interface.js';
4
+ type UndefinedPartial<T> = {
5
5
  [K in keyof T]?: T[K] | undefined;
6
6
  };
7
7
  export declare class InternalException extends Error implements BaseError {
@@ -1 +1 @@
1
- {"version":3,"file":"internal.exception.d.ts","sourceRoot":"","sources":["../../src/internal.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,aAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAClC,CAAC;AAOF,qBAAa,iBAAkB,SAAQ,KAAM,YAAW,SAAS;WACjD,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB;WAI9C,WAAW,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,SAAS;IAiCnE,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEvB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,GAAG,CAAC,EAAE,YAAY;IAUvB,QAAQ;IAMR,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE;AAGD,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,SAAU,SAAQ,gBAAgB,CAAC,SAAS,CAAC;QAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;KACpC;CACF"}
1
+ {"version":3,"file":"internal.exception.d.ts","sourceRoot":"","sources":["../../src/internal.exception.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,KAAK,gBAAgB,CAAC,CAAC,IAAI;KACxB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CAClC,CAAC;AAQF,qBAAa,iBAAkB,SAAQ,KAAM,YAAW,SAAS;WACjD,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,iBAAiB;WAI9C,WAAW,CAAC,GAAG,CAAC,EAAE,YAAY,GAAG,iBAAiB,CAAC,SAAS;IAiCnE,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAEvB,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAEb,GAAG,CAAC,EAAE,YAAY;IAUvB,QAAQ;IAMR,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;CAGlE;AAGD,yBAAiB,iBAAiB,CAAC;IACjC,UAAiB,SAAU,SAAQ,gBAAgB,CAAC,SAAS,CAAC;QAC5D,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;KACpC;CACF"}
@@ -3,17 +3,6 @@ const isObject = (value) => !!value && typeof value === 'object';
3
3
  const hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
4
4
  const isErrorLike = (error) => isObject(error) && hasProperty(error, 'message') && typeof error.message === 'string';
5
5
  export class InternalException extends Error {
6
- constructor(msg) {
7
- const data = InternalException.extractData(msg);
8
- super(data.message);
9
- this.name = this.constructor.name;
10
- if (data.details)
11
- this.details = data.details;
12
- if (data.errorCode)
13
- this.errorCode = data.errorCode;
14
- if (data.cause)
15
- this.cause = data.cause;
16
- }
17
6
  static instanceOf(err) {
18
7
  return err instanceof InternalException;
19
8
  }
@@ -50,6 +39,17 @@ export class InternalException extends Error {
50
39
  cause,
51
40
  };
52
41
  }
42
+ constructor(msg) {
43
+ const data = InternalException.extractData(msg);
44
+ super(data.message);
45
+ this.name = this.constructor.name;
46
+ if (data.details)
47
+ this.details = data.details;
48
+ if (data.errorCode)
49
+ this.errorCode = data.errorCode;
50
+ if (data.cause)
51
+ this.cause = data.cause;
52
+ }
53
53
  getCause() {
54
54
  if (typeof this.cause === 'string')
55
55
  return this.cause;
package/package.json CHANGED
@@ -1,52 +1,46 @@
1
1
  {
2
2
  "name": "@voiceflow/exception",
3
+ "version": "1.6.1",
3
4
  "description": "Voiceflow standard exceptions and error codes",
4
- "version": "1.5.4",
5
- "author": "Voiceflow",
6
- "bugs": {
7
- "url": "https://github.com/voiceflow/libs/issues"
8
- },
9
- "files": [
10
- "build"
11
- ],
12
- "homepage": "https://github.com/voiceflow/libs#readme",
13
5
  "keywords": [
14
6
  "voiceflow"
15
7
  ],
16
- "devDependencies": {
17
- "@voiceflow-meta/typescript-config": "1.0.2"
18
- },
19
- "license": "ISC",
20
- "main": "build/cjs/main.js",
21
- "module": "build/esm/main.js",
22
- "publishConfig": {
23
- "access": "public"
8
+ "homepage": "https://github.com/voiceflow/libs#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/voiceflow/libs/issues"
24
11
  },
25
12
  "repository": {
26
13
  "type": "git",
27
14
  "url": "git+https://github.com/voiceflow/libs.git"
28
15
  },
16
+ "license": "ISC",
17
+ "author": "Voiceflow",
18
+ "main": "build/cjs/main.js",
19
+ "module": "build/esm/main.js",
20
+ "types": "build/cjs/main.d.ts",
21
+ "files": [
22
+ "build"
23
+ ],
29
24
  "scripts": {
30
- "build": "yarn clean && yarn build:cjs && yarn build:esm",
31
- "build:cjs": "yarn g:tsc -p tsconfig.build.cjs.json && yarn g:tsc-alias -p tsconfig.build.cjs.json && yarn postbuild:cjs",
32
- "build:esm": "yarn g:tsc -p tsconfig.build.esm.json && yarn g:tsc-alias -p tsconfig.build.esm.json && yarn postbuild:esm",
25
+ "build": "yarn g:turbo run build:cmd --filter=@voiceflow/exception...",
26
+ "build:cjs": "yarn g:build:pkg cjs",
27
+ "build:cmd": "yarn g:run-p build:cjs build:esm",
28
+ "build:esm": "yarn g:build:pkg esm",
33
29
  "clean": "yarn g:rimraf build",
34
- "commit": "cz",
35
- "lint": "yarn g:eslint '**/*.{js,ts}'",
36
- "lint:fix": "yarn lint --fix",
37
- "lint:quiet": "yarn lint --quiet",
38
- "lint:report": "yarn g:eslint-output --quiet '**/*.{js,ts}'",
39
- "postbuild:cjs": "touch build/cjs/package.json && echo '{ \"type\": \"commonjs\" }' > build/cjs/package.json",
40
- "postbuild:esm": "touch build/esm/package.json && echo '{ \"type\": \"module\" }' > build/esm/package.json",
41
- "tdd": "yarn test --watch",
42
- "test": "exit 0",
43
- "test:dependencies": "yarn g:depcheck",
44
- "test:integration": "exit 0",
45
- "test:unit": "exit 0"
30
+ "lint": "yarn g:run-p -c lint:eslint lint:prettier",
31
+ "lint:eslint": "yarn g:eslint",
32
+ "lint:fix": "yarn g:run-p -c \"lint:eslint --fix\" \"lint:prettier --write\"",
33
+ "lint:prettier": "yarn g:prettier --check",
34
+ "test": "yarn g:run-p -c test:dependencies test:types",
35
+ "test:dependencies": "yarn g:depcruise",
36
+ "test:types": "yarn g:tsc --noEmit",
37
+ "test:unit": ""
46
38
  },
47
- "types": "build/cjs/main.d.ts",
48
39
  "volta": {
49
40
  "extends": "../../package.json"
50
41
  },
51
- "gitHead": "14334e394022769620436e607881f0e364ebd81f"
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "gitHead": "123b2b6ed54ba2833fc56acc1b4258e8c2974223"
52
46
  }