@lokalise/node-core 9.12.0 → 9.13.0
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/README.md +1 -1
- package/dist/src/errors/InternalError.d.ts +1 -0
- package/dist/src/errors/InternalError.js +3 -1
- package/dist/src/errors/InternalError.js.map +1 -1
- package/dist/src/errors/PublicNonRecoverableError.d.ts +1 -0
- package/dist/src/errors/PublicNonRecoverableError.js +3 -1
- package/dist/src/errors/PublicNonRecoverableError.js.map +1 -1
- package/dist/src/errors/publicErrors.d.ts +2 -4
- package/dist/src/errors/publicErrors.js +3 -0
- package/dist/src/errors/publicErrors.js.map +1 -1
- package/dist/src/http/httpClient.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ All _send_ methods accept a type parameter and the following arguments:
|
|
|
38
38
|
|
|
39
39
|
- `headers`;
|
|
40
40
|
- `query`, query string params to be embedded in the request URL;
|
|
41
|
-
- `timeout`, the timeout after which a request will time out, in milliseconds;
|
|
41
|
+
- `timeout`, the timeout after which a request will time out, in milliseconds. Default is 30 seconds. Pass `undefined` if you prefer to have no timeout;
|
|
42
42
|
- `throwOnError`;`
|
|
43
43
|
- `reqContext`;
|
|
44
44
|
- `safeParseJson`, used when the response content-type is `application/json`. If `true`, the response body will be parsed as JSON and a `ResponseError` will be thrown in case of syntax errors. If `false`, errors are not handled;
|
|
@@ -5,7 +5,9 @@ class InternalError extends Error {
|
|
|
5
5
|
details;
|
|
6
6
|
errorCode;
|
|
7
7
|
constructor(params) {
|
|
8
|
-
super(params.message
|
|
8
|
+
super(params.message, {
|
|
9
|
+
cause: params.cause,
|
|
10
|
+
});
|
|
9
11
|
this.name = 'InternalError';
|
|
10
12
|
this.details = params.details;
|
|
11
13
|
this.errorCode = params.errorCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../../src/errors/InternalError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"InternalError.js","sourceRoot":"","sources":["../../../src/errors/InternalError.ts"],"names":[],"mappings":";;;AASA,MAAa,aAAgC,SAAQ,KAAK;IACxC,OAAO,CAAI;IACX,SAAS,CAAQ;IAEjC,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;IACnC,CAAC;CACF;AAZD,sCAYC"}
|
|
@@ -9,7 +9,9 @@ class PublicNonRecoverableError extends Error {
|
|
|
9
9
|
errorCode;
|
|
10
10
|
httpStatusCode;
|
|
11
11
|
constructor(params) {
|
|
12
|
-
super(params.message
|
|
12
|
+
super(params.message, {
|
|
13
|
+
cause: params.cause,
|
|
14
|
+
});
|
|
13
15
|
this.name = 'PublicNonRecoverableError';
|
|
14
16
|
this.details = params.details;
|
|
15
17
|
this.errorCode = params.errorCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PublicNonRecoverableError.js","sourceRoot":"","sources":["../../../src/errors/PublicNonRecoverableError.ts"],"names":[],"mappings":";;;AAUA;;GAEG;AACH,MAAa,yBAA0B,SAAQ,KAAK;IAClC,OAAO,CAAe;IACtB,SAAS,CAAQ;IACjB,cAAc,CAAQ;IAEtC,YAAY,MAAuC;QACjD,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;QACF,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QAC7B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACjC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,GAAG,CAAA;IACpD,CAAC;CACF;AAdD,8DAcC"}
|
|
@@ -3,11 +3,9 @@ import { PublicNonRecoverableError } from './PublicNonRecoverableError';
|
|
|
3
3
|
export type CommonErrorParams = {
|
|
4
4
|
message: string;
|
|
5
5
|
details?: FreeformRecord;
|
|
6
|
+
cause?: Error;
|
|
6
7
|
};
|
|
7
|
-
export type OptionalMessageErrorParams =
|
|
8
|
-
message?: string;
|
|
9
|
-
details?: FreeformRecord;
|
|
10
|
-
};
|
|
8
|
+
export type OptionalMessageErrorParams = Partial<CommonErrorParams>;
|
|
11
9
|
export type ValidationError = {
|
|
12
10
|
message: string;
|
|
13
11
|
path: string[];
|
|
@@ -23,6 +23,7 @@ class AccessDeniedError extends PublicNonRecoverableError_1.PublicNonRecoverable
|
|
|
23
23
|
errorCode: 'ACCESS_DENIED',
|
|
24
24
|
httpStatusCode: node_http2_1.constants.HTTP_STATUS_FORBIDDEN,
|
|
25
25
|
details: params.details,
|
|
26
|
+
cause: params.cause,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -34,6 +35,7 @@ class EntityNotFoundError extends PublicNonRecoverableError_1.PublicNonRecoverab
|
|
|
34
35
|
errorCode: 'ENTITY_NOT_FOUND',
|
|
35
36
|
httpStatusCode: node_http2_1.constants.HTTP_STATUS_NOT_FOUND,
|
|
36
37
|
details: params.details,
|
|
38
|
+
cause: params.cause,
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -45,6 +47,7 @@ class AuthFailedError extends PublicNonRecoverableError_1.PublicNonRecoverableEr
|
|
|
45
47
|
errorCode: 'AUTH_FAILED',
|
|
46
48
|
httpStatusCode: node_http2_1.constants.HTTP_STATUS_UNAUTHORIZED,
|
|
47
49
|
details: params.details,
|
|
50
|
+
cause: params.cause,
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicErrors.js","sourceRoot":"","sources":["../../../src/errors/publicErrors.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAIvD,2EAAuE;
|
|
1
|
+
{"version":3,"file":"publicErrors.js","sourceRoot":"","sources":["../../../src/errors/publicErrors.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAIvD,2EAAuE;AAevE,MAAa,sBAAuB,SAAQ,qDAAyB;IACnE,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,gBAAgB;YACzB,SAAS,EAAE,kBAAkB;YAC7B,cAAc,EAAE,sBAAa,CAAC,uBAAuB;YACrD,OAAO,EAAE;gBACP,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAXD,wDAWC;AAED,MAAa,iBAAkB,SAAQ,qDAAyB;IAC9D,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,eAAe;YAC1B,cAAc,EAAE,sBAAa,CAAC,qBAAqB;YACnD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,8CAUC;AAED,MAAa,mBAAoB,SAAQ,qDAAyB;IAChE,YAAY,MAAyB;QACnC,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,SAAS,EAAE,kBAAkB;YAC7B,cAAc,EAAE,sBAAa,CAAC,qBAAqB;YACnD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,kDAUC;AAED,MAAa,eAAgB,SAAQ,qDAAyB;IAC5D,YAAY,SAAqC,EAAE;QACjD,KAAK,CAAC;YACJ,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,uBAAuB;YAClD,SAAS,EAAE,aAAa;YACxB,cAAc,EAAE,sBAAa,CAAC,wBAAwB;YACtD,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC,CAAA;IACJ,CAAC;CACF;AAVD,0CAUC"}
|