@zuplo/errors 6.2.1 → 6.2.4
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/errors.d.ts +2 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/package.json +2 -2
- package/src/errors.ts +3 -3
package/dist/errors.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ProblemDetails, ProblemDetailsFactory } from "./interfaces.js";
|
|
2
2
|
import * as Problems from "./problems.js";
|
|
3
|
-
export {
|
|
3
|
+
export { ProblemDetails, ProblemDetailsFactory, Problems };
|
|
4
4
|
/**
|
|
5
5
|
* The default format for Api errors
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@ export declare class ApiError extends Error {
|
|
|
9
9
|
status: number;
|
|
10
10
|
detail?: string;
|
|
11
11
|
instance?: string;
|
|
12
|
-
constructor(problem: ProblemDetails);
|
|
12
|
+
constructor(problem: ProblemDetails, options?: ErrorOptions);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Not found error
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,QAAQ,EAAE,CAAC;AAC3D;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,YAAY;CAe5D;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;gBAChC,OAAO,GAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,UAAU,CAAM;CAOtE"}
|
package/dist/errors.js
CHANGED
|
@@ -8,8 +8,8 @@ export class ApiError extends Error {
|
|
|
8
8
|
status;
|
|
9
9
|
detail;
|
|
10
10
|
instance;
|
|
11
|
-
constructor(problem) {
|
|
12
|
-
super(problem.title);
|
|
11
|
+
constructor(problem, options) {
|
|
12
|
+
super(problem.title, options);
|
|
13
13
|
if (!problem.type.startsWith("https://zup.fail/")) {
|
|
14
14
|
throw new Error(`Invalid 'type' specified on ApiError, must be a URI starting with 'https://zup.fail/'. Type was set to ${problem.type}`);
|
|
15
15
|
}
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAyC,QAAQ,EAAE,CAAC;AAC3D;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IAC1B,IAAI,CAAS;IACb,MAAM,CAAS;IACf,MAAM,CAAU;IAChB,QAAQ,CAAU;IAEzB,YAAY,OAAuB,EAAE,OAAsB;QACzD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAE9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CACb,0GAA0G,OAAO,CAAC,IAAI,EAAE,CACzH,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAC5C,YAAY,UAAuD,EAAE;QACnE,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,GAAG,QAAQ,CAAC,SAAS;SACtB,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@zuplo/errors",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "6.2.
|
|
5
|
+
"version": "6.2.4",
|
|
6
6
|
"description": "Error types",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"@types/node": "^20.14.8",
|
|
30
30
|
"chai": "^4.4.1",
|
|
31
31
|
"mocha": "^10.7.0",
|
|
32
|
-
"typescript": "^5.
|
|
32
|
+
"typescript": "^5.6.2"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/src/errors.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProblemDetails, ProblemDetailsFactory } from "./interfaces.js";
|
|
2
2
|
import * as Problems from "./problems.js";
|
|
3
3
|
|
|
4
|
-
export {
|
|
4
|
+
export { ProblemDetails, ProblemDetailsFactory, Problems };
|
|
5
5
|
/**
|
|
6
6
|
* The default format for Api errors
|
|
7
7
|
*/
|
|
@@ -11,8 +11,8 @@ export class ApiError extends Error {
|
|
|
11
11
|
public detail?: string;
|
|
12
12
|
public instance?: string;
|
|
13
13
|
|
|
14
|
-
constructor(problem: ProblemDetails) {
|
|
15
|
-
super(problem.title);
|
|
14
|
+
constructor(problem: ProblemDetails, options?: ErrorOptions) {
|
|
15
|
+
super(problem.title, options);
|
|
16
16
|
|
|
17
17
|
if (!problem.type.startsWith("https://zup.fail/")) {
|
|
18
18
|
throw new Error(
|