@feathersjs/errors 5.0.37 → 6.0.0-pre.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/CHANGELOG.md +54 -0
- package/LICENSE +1 -2
- package/README.md +1 -1
- package/lib/index.d.ts +1 -146
- package/lib/index.js +1 -209
- package/lib/index.js.map +1 -1
- package/package.json +9 -7
- package/src/index.ts +1 -273
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,60 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 6.0.0-pre.0 (2026-01-31)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
|
|
11
|
+
- **compile-task:** on windows machine ([#60](https://github.com/feathersjs/feathers/issues/60)) ([617e0a4](https://github.com/feathersjs/feathers/commit/617e0a4b2cad33e77306ea716297d5946dc8c937))
|
|
12
|
+
- **core:** Update to latest feathersjs/hooks ([#3434](https://github.com/feathersjs/feathers/issues/3434)) ([1499ccc](https://github.com/feathersjs/feathers/commit/1499ccc41fb3ebba97b2c84e0cb19bc48ad3c651))
|
|
13
|
+
- **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
14
|
+
- **dependencies:** Update all dependencies ([#3139](https://github.com/feathersjs/feathers/issues/3139)) ([f24276e](https://github.com/feathersjs/feathers/commit/f24276e9a909e2e58a0730c730258ce1f70f4028))
|
|
15
|
+
- **dependencies:** Update all dependencies ([#3545](https://github.com/feathersjs/feathers/issues/3545)) ([221b92b](https://github.com/feathersjs/feathers/commit/221b92bb0ee5d54fb1036742968797cb02e56da2))
|
|
16
|
+
- **dependencies:** Update all dependencies ([#3625](https://github.com/feathersjs/feathers/issues/3625)) ([2698e4e](https://github.com/feathersjs/feathers/commit/2698e4e2996fbf479d82435938d907bc3d5b583a))
|
|
17
|
+
- **dependencies:** Update dependencies ([#3571](https://github.com/feathersjs/feathers/issues/3571)) ([ad611cb](https://github.com/feathersjs/feathers/commit/ad611cb6ffb1dc31d603ba5817331318c5a23217))
|
|
18
|
+
- Do not log as errors below a 500 response ([#1256](https://github.com/feathersjs/feathers/issues/1256)) ([33fd0e4](https://github.com/feathersjs/feathers/commit/33fd0e4ae26e4aaf7b5da9d4797ec0dc7330ebbe))
|
|
19
|
+
- **errors:** Add 410 Gone to errors ([#1849](https://github.com/feathersjs/feathers/issues/1849)) ([6801428](https://github.com/feathersjs/feathers/commit/6801428f8fd17dbfebcdb6f1b0cd01433a4033dc))
|
|
20
|
+
- **errors:** Allows to pass no error message ([#2794](https://github.com/feathersjs/feathers/issues/2794)) ([f3ddab6](https://github.com/feathersjs/feathers/commit/f3ddab637e269e67e852ffce07b060bab2b085c0))
|
|
21
|
+
- **errors:** Format package.json with spaces ([cbd31c1](https://github.com/feathersjs/feathers/commit/cbd31c10c2c574de63d6ca5e55dbfb73a5fdd758))
|
|
22
|
+
- **knex:** Update all dependencies and Knex peer ([#3308](https://github.com/feathersjs/feathers/issues/3308)) ([d2f9860](https://github.com/feathersjs/feathers/commit/d2f986036c4741cce2339d8abbcc6b2eb037a12a))
|
|
23
|
+
- Make Mocha a proper devDependency for every repository ([#1053](https://github.com/feathersjs/feathers/issues/1053)) ([9974803](https://github.com/feathersjs/feathers/commit/99748032a6571a792883be31ec955a749629d0da))
|
|
24
|
+
- Make sure all Readme files are up to date ([#3154](https://github.com/feathersjs/feathers/issues/3154)) ([a5f0b38](https://github.com/feathersjs/feathers/commit/a5f0b38bbf2a11486415a39533bcc6c67fb51e3e))
|
|
25
|
+
- **package:** update debug to version 3.0.0 ([#86](https://github.com/feathersjs/feathers/issues/86)) ([fd1bb6b](https://github.com/feathersjs/feathers/commit/fd1bb6b8dd4108447ca2c741e0a4ea9bfe117af4))
|
|
26
|
+
- Small type improvements ([#1624](https://github.com/feathersjs/feathers/issues/1624)) ([50162c6](https://github.com/feathersjs/feathers/commit/50162c6e562f0a47c6a280c4f01fff7c3afee293))
|
|
27
|
+
- **typescript:** Fix `data` property definition in @feathersjs/errors ([#2018](https://github.com/feathersjs/feathers/issues/2018)) ([ef1398c](https://github.com/feathersjs/feathers/commit/ef1398cd5b19efa50929e8c9511ca5684a18997f))
|
|
28
|
+
- **typescript:** Improve TypeScript backwards compatibility ([#2310](https://github.com/feathersjs/feathers/issues/2310)) ([f33be73](https://github.com/feathersjs/feathers/commit/f33be73fc46a533efb15df9aab0658e3240d3897))
|
|
29
|
+
- Update 401.html ([#983](https://github.com/feathersjs/feathers/issues/983)) ([cec6bae](https://github.com/feathersjs/feathers/commit/cec6baea05ba26a145faffbce9947be7ed1ccf4e))
|
|
30
|
+
- Update 404.html ([#984](https://github.com/feathersjs/feathers/issues/984)) ([72132d1](https://github.com/feathersjs/feathers/commit/72132d119097b8a01b7eccdf8ff0123ed6025079))
|
|
31
|
+
- Update adapter common tests ([#1135](https://github.com/feathersjs/feathers/issues/1135)) ([8166dda](https://github.com/feathersjs/feathers/commit/8166ddad144350f224d0fd9fc66084d28706326c))
|
|
32
|
+
- Update all dependencies ([#3613](https://github.com/feathersjs/feathers/issues/3613)) ([5136bbd](https://github.com/feathersjs/feathers/commit/5136bbd2e2eeb4e6579e07c9e914006629542363))
|
|
33
|
+
- Update all dependencies to latest ([#1206](https://github.com/feathersjs/feathers/issues/1206)) ([e51e0f6](https://github.com/feathersjs/feathers/commit/e51e0f62d0f338fb59bd0d39952d99c2904a0c3f))
|
|
34
|
+
- Update dependencies ([#3584](https://github.com/feathersjs/feathers/issues/3584)) ([119fa4e](https://github.com/feathersjs/feathers/commit/119fa4e1ade8b0078aa235083d566e2538b3a084))
|
|
35
|
+
- Update dependencies and fix tests ([#1373](https://github.com/feathersjs/feathers/issues/1373)) ([d743a7f](https://github.com/feathersjs/feathers/commit/d743a7ff7b0f9f94aa6fa8e29d0c816469c9b8ab))
|
|
36
|
+
- Update Grant usage and other dependencies ([#2264](https://github.com/feathersjs/feathers/issues/2264)) ([7b0f8fa](https://github.com/feathersjs/feathers/commit/7b0f8fad252419ed0ad0bf259cdf3104d322ab60))
|
|
37
|
+
- Use `export =` in TypeScript definitions ([#1285](https://github.com/feathersjs/feathers/issues/1285)) ([12d0f4b](https://github.com/feathersjs/feathers/commit/12d0f4b9e4ce5d6771163a41ebe58cf83af342c7))
|
|
38
|
+
|
|
39
|
+
### Features
|
|
40
|
+
|
|
41
|
+
- Add TypeScript definitions ([#1275](https://github.com/feathersjs/feathers/issues/1275)) ([9dd6713](https://github.com/feathersjs/feathers/commit/9dd671301ae0463968ade0f6eb0c82356adcc89d))
|
|
42
|
+
- Authentication v3 core server implementation ([#1205](https://github.com/feathersjs/feathers/issues/1205)) ([1bd7591](https://github.com/feathersjs/feathers/commit/1bd7591548da58c1c0facb2a733ce32524743ff3))
|
|
43
|
+
- **core:** Allow to unregister services at runtime ([#2756](https://github.com/feathersjs/feathers/issues/2756)) ([d16601f](https://github.com/feathersjs/feathers/commit/d16601f2277dca5357866ffdefba2a611f6dc7fa))
|
|
44
|
+
- ES module v5 compatibility layer for v6 ([#3607](https://github.com/feathersjs/feathers/issues/3607)) ([1dfff88](https://github.com/feathersjs/feathers/commit/1dfff8832eedca895eeaafd7f3acf0f8a27be23c))
|
|
45
|
+
- **generators:** Move core code generators to shared generators package ([#2982](https://github.com/feathersjs/feathers/issues/2982)) ([0328d22](https://github.com/feathersjs/feathers/commit/0328d2292153870bc43958f73d2c6f288a8cec17))
|
|
46
|
+
- v5 compatibility layer for v6 ([7415d5a](https://github.com/feathersjs/feathers/commit/7415d5addbb9943cfaf8a7a942ca542c6d99bceb))
|
|
47
|
+
|
|
48
|
+
### BREAKING CHANGES
|
|
49
|
+
|
|
50
|
+
- All packages are now ES modules only
|
|
51
|
+
|
|
52
|
+
## [5.0.39](https://github.com/feathersjs/feathers/compare/v5.0.38...v5.0.39) (2026-01-31)
|
|
53
|
+
|
|
54
|
+
**Note:** Version bump only for package @feathersjs/errors
|
|
55
|
+
|
|
56
|
+
## [5.0.38](https://github.com/feathersjs/feathers/compare/v5.0.37...v5.0.38) (2026-01-31)
|
|
57
|
+
|
|
58
|
+
**Note:** Version bump only for package @feathersjs/errors
|
|
59
|
+
|
|
6
60
|
## [5.0.37](https://github.com/feathersjs/feathers/compare/v5.0.36...v5.0.37) (2025-11-10)
|
|
7
61
|
|
|
8
62
|
**Note:** Version bump only for package @feathersjs/errors
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Feathers Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
-
|
package/README.md
CHANGED
|
@@ -18,6 +18,6 @@ Refer to the [Feathers errors API documentation](https://feathersjs.com/api/erro
|
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
21
|
-
Copyright (c)
|
|
21
|
+
Copyright (c) 2025 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
22
|
|
|
23
23
|
Licensed under the [MIT license](LICENSE).
|
package/lib/index.d.ts
CHANGED
|
@@ -1,146 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: string;
|
|
3
|
-
message: string;
|
|
4
|
-
code: number;
|
|
5
|
-
className: string;
|
|
6
|
-
data?: any;
|
|
7
|
-
errors?: any;
|
|
8
|
-
}
|
|
9
|
-
export type DynamicError = Error & {
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
export type ErrorMessage = null | string | DynamicError | {
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
} | any[];
|
|
15
|
-
export declare class FeathersError extends Error {
|
|
16
|
-
readonly type: string;
|
|
17
|
-
readonly code: number;
|
|
18
|
-
readonly className: string;
|
|
19
|
-
readonly data: any;
|
|
20
|
-
readonly errors: any;
|
|
21
|
-
constructor(err: ErrorMessage, name: string, code: number, className: string, _data: any);
|
|
22
|
-
toJSON(): FeathersErrorJSON;
|
|
23
|
-
}
|
|
24
|
-
export declare class BadRequest extends FeathersError {
|
|
25
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
26
|
-
}
|
|
27
|
-
export declare class NotAuthenticated extends FeathersError {
|
|
28
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
29
|
-
}
|
|
30
|
-
export declare class PaymentError extends FeathersError {
|
|
31
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
32
|
-
}
|
|
33
|
-
export declare class Forbidden extends FeathersError {
|
|
34
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
35
|
-
}
|
|
36
|
-
export declare class NotFound extends FeathersError {
|
|
37
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
38
|
-
}
|
|
39
|
-
export declare class MethodNotAllowed extends FeathersError {
|
|
40
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
41
|
-
}
|
|
42
|
-
export declare class NotAcceptable extends FeathersError {
|
|
43
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
44
|
-
}
|
|
45
|
-
export declare class Timeout extends FeathersError {
|
|
46
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
47
|
-
}
|
|
48
|
-
export declare class Conflict extends FeathersError {
|
|
49
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
50
|
-
}
|
|
51
|
-
export declare class Gone extends FeathersError {
|
|
52
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
53
|
-
}
|
|
54
|
-
export declare class LengthRequired extends FeathersError {
|
|
55
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
56
|
-
}
|
|
57
|
-
export declare class Unprocessable extends FeathersError {
|
|
58
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
59
|
-
}
|
|
60
|
-
export declare class TooManyRequests extends FeathersError {
|
|
61
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
62
|
-
}
|
|
63
|
-
export declare class GeneralError extends FeathersError {
|
|
64
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
65
|
-
}
|
|
66
|
-
export declare class NotImplemented extends FeathersError {
|
|
67
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
68
|
-
}
|
|
69
|
-
export declare class BadGateway extends FeathersError {
|
|
70
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
71
|
-
}
|
|
72
|
-
export declare class Unavailable extends FeathersError {
|
|
73
|
-
constructor(message?: ErrorMessage, data?: any);
|
|
74
|
-
}
|
|
75
|
-
export interface Errors {
|
|
76
|
-
FeathersError: FeathersError;
|
|
77
|
-
BadRequest: BadRequest;
|
|
78
|
-
NotAuthenticated: NotAuthenticated;
|
|
79
|
-
PaymentError: PaymentError;
|
|
80
|
-
Forbidden: Forbidden;
|
|
81
|
-
NotFound: NotFound;
|
|
82
|
-
MethodNotAllowed: MethodNotAllowed;
|
|
83
|
-
NotAcceptable: NotAcceptable;
|
|
84
|
-
Timeout: Timeout;
|
|
85
|
-
Conflict: Conflict;
|
|
86
|
-
LengthRequired: LengthRequired;
|
|
87
|
-
Unprocessable: Unprocessable;
|
|
88
|
-
TooManyRequests: TooManyRequests;
|
|
89
|
-
GeneralError: GeneralError;
|
|
90
|
-
NotImplemented: NotImplemented;
|
|
91
|
-
BadGateway: BadGateway;
|
|
92
|
-
Unavailable: Unavailable;
|
|
93
|
-
400: BadRequest;
|
|
94
|
-
401: NotAuthenticated;
|
|
95
|
-
402: PaymentError;
|
|
96
|
-
403: Forbidden;
|
|
97
|
-
404: NotFound;
|
|
98
|
-
405: MethodNotAllowed;
|
|
99
|
-
406: NotAcceptable;
|
|
100
|
-
408: Timeout;
|
|
101
|
-
409: Conflict;
|
|
102
|
-
411: LengthRequired;
|
|
103
|
-
422: Unprocessable;
|
|
104
|
-
429: TooManyRequests;
|
|
105
|
-
500: GeneralError;
|
|
106
|
-
501: NotImplemented;
|
|
107
|
-
502: BadGateway;
|
|
108
|
-
503: Unavailable;
|
|
109
|
-
}
|
|
110
|
-
export declare const errors: {
|
|
111
|
-
FeathersError: typeof FeathersError;
|
|
112
|
-
BadRequest: typeof BadRequest;
|
|
113
|
-
NotAuthenticated: typeof NotAuthenticated;
|
|
114
|
-
PaymentError: typeof PaymentError;
|
|
115
|
-
Forbidden: typeof Forbidden;
|
|
116
|
-
NotFound: typeof NotFound;
|
|
117
|
-
MethodNotAllowed: typeof MethodNotAllowed;
|
|
118
|
-
NotAcceptable: typeof NotAcceptable;
|
|
119
|
-
Timeout: typeof Timeout;
|
|
120
|
-
Conflict: typeof Conflict;
|
|
121
|
-
LengthRequired: typeof LengthRequired;
|
|
122
|
-
Unprocessable: typeof Unprocessable;
|
|
123
|
-
TooManyRequests: typeof TooManyRequests;
|
|
124
|
-
GeneralError: typeof GeneralError;
|
|
125
|
-
NotImplemented: typeof NotImplemented;
|
|
126
|
-
BadGateway: typeof BadGateway;
|
|
127
|
-
Unavailable: typeof Unavailable;
|
|
128
|
-
400: typeof BadRequest;
|
|
129
|
-
401: typeof NotAuthenticated;
|
|
130
|
-
402: typeof PaymentError;
|
|
131
|
-
403: typeof Forbidden;
|
|
132
|
-
404: typeof NotFound;
|
|
133
|
-
405: typeof MethodNotAllowed;
|
|
134
|
-
406: typeof NotAcceptable;
|
|
135
|
-
408: typeof Timeout;
|
|
136
|
-
409: typeof Conflict;
|
|
137
|
-
410: typeof Gone;
|
|
138
|
-
411: typeof LengthRequired;
|
|
139
|
-
422: typeof Unprocessable;
|
|
140
|
-
429: typeof TooManyRequests;
|
|
141
|
-
500: typeof GeneralError;
|
|
142
|
-
501: typeof NotImplemented;
|
|
143
|
-
502: typeof BadGateway;
|
|
144
|
-
503: typeof Unavailable;
|
|
145
|
-
};
|
|
146
|
-
export declare function convert(error: any): any;
|
|
1
|
+
export * from 'feathers/errors';
|
package/lib/index.js
CHANGED
|
@@ -1,210 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errors = exports.Unavailable = exports.BadGateway = exports.NotImplemented = exports.GeneralError = exports.TooManyRequests = exports.Unprocessable = exports.LengthRequired = exports.Gone = exports.Conflict = exports.Timeout = exports.NotAcceptable = exports.MethodNotAllowed = exports.NotFound = exports.Forbidden = exports.PaymentError = exports.NotAuthenticated = exports.BadRequest = exports.FeathersError = void 0;
|
|
4
|
-
exports.convert = convert;
|
|
5
|
-
class FeathersError extends Error {
|
|
6
|
-
constructor(err, name, code, className, _data) {
|
|
7
|
-
let msg = typeof err === 'string' ? err : 'Error';
|
|
8
|
-
const properties = {
|
|
9
|
-
name,
|
|
10
|
-
code,
|
|
11
|
-
className,
|
|
12
|
-
type: 'FeathersError'
|
|
13
|
-
};
|
|
14
|
-
if (Array.isArray(_data)) {
|
|
15
|
-
properties.data = _data;
|
|
16
|
-
}
|
|
17
|
-
else if (typeof err === 'object' || _data !== undefined) {
|
|
18
|
-
const { message, errors, ...rest } = err !== null && typeof err === 'object' ? err : _data;
|
|
19
|
-
msg = message || msg;
|
|
20
|
-
properties.errors = errors;
|
|
21
|
-
properties.data = rest;
|
|
22
|
-
}
|
|
23
|
-
super(msg);
|
|
24
|
-
Object.assign(this, properties);
|
|
25
|
-
}
|
|
26
|
-
toJSON() {
|
|
27
|
-
const result = {
|
|
28
|
-
name: this.name,
|
|
29
|
-
message: this.message,
|
|
30
|
-
code: this.code,
|
|
31
|
-
className: this.className
|
|
32
|
-
};
|
|
33
|
-
if (this.data !== undefined) {
|
|
34
|
-
result.data = this.data;
|
|
35
|
-
}
|
|
36
|
-
if (this.errors !== undefined) {
|
|
37
|
-
result.errors = this.errors;
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.FeathersError = FeathersError;
|
|
43
|
-
class BadRequest extends FeathersError {
|
|
44
|
-
constructor(message, data) {
|
|
45
|
-
super(message, 'BadRequest', 400, 'bad-request', data);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
exports.BadRequest = BadRequest;
|
|
49
|
-
// 401 - Not Authenticated
|
|
50
|
-
class NotAuthenticated extends FeathersError {
|
|
51
|
-
constructor(message, data) {
|
|
52
|
-
super(message, 'NotAuthenticated', 401, 'not-authenticated', data);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.NotAuthenticated = NotAuthenticated;
|
|
56
|
-
// 402 - Payment Error
|
|
57
|
-
class PaymentError extends FeathersError {
|
|
58
|
-
constructor(message, data) {
|
|
59
|
-
super(message, 'PaymentError', 402, 'payment-error', data);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.PaymentError = PaymentError;
|
|
63
|
-
// 403 - Forbidden
|
|
64
|
-
class Forbidden extends FeathersError {
|
|
65
|
-
constructor(message, data) {
|
|
66
|
-
super(message, 'Forbidden', 403, 'forbidden', data);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.Forbidden = Forbidden;
|
|
70
|
-
// 404 - Not Found
|
|
71
|
-
class NotFound extends FeathersError {
|
|
72
|
-
constructor(message, data) {
|
|
73
|
-
super(message, 'NotFound', 404, 'not-found', data);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.NotFound = NotFound;
|
|
77
|
-
// 405 - Method Not Allowed
|
|
78
|
-
class MethodNotAllowed extends FeathersError {
|
|
79
|
-
constructor(message, data) {
|
|
80
|
-
super(message, 'MethodNotAllowed', 405, 'method-not-allowed', data);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.MethodNotAllowed = MethodNotAllowed;
|
|
84
|
-
// 406 - Not Acceptable
|
|
85
|
-
class NotAcceptable extends FeathersError {
|
|
86
|
-
constructor(message, data) {
|
|
87
|
-
super(message, 'NotAcceptable', 406, 'not-acceptable', data);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.NotAcceptable = NotAcceptable;
|
|
91
|
-
// 408 - Timeout
|
|
92
|
-
class Timeout extends FeathersError {
|
|
93
|
-
constructor(message, data) {
|
|
94
|
-
super(message, 'Timeout', 408, 'timeout', data);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.Timeout = Timeout;
|
|
98
|
-
// 409 - Conflict
|
|
99
|
-
class Conflict extends FeathersError {
|
|
100
|
-
constructor(message, data) {
|
|
101
|
-
super(message, 'Conflict', 409, 'conflict', data);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.Conflict = Conflict;
|
|
105
|
-
// 410 - Gone
|
|
106
|
-
class Gone extends FeathersError {
|
|
107
|
-
constructor(message, data) {
|
|
108
|
-
super(message, 'Gone', 410, 'gone', data);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.Gone = Gone;
|
|
112
|
-
// 411 - Length Required
|
|
113
|
-
class LengthRequired extends FeathersError {
|
|
114
|
-
constructor(message, data) {
|
|
115
|
-
super(message, 'LengthRequired', 411, 'length-required', data);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.LengthRequired = LengthRequired;
|
|
119
|
-
// 422 Unprocessable
|
|
120
|
-
class Unprocessable extends FeathersError {
|
|
121
|
-
constructor(message, data) {
|
|
122
|
-
super(message, 'Unprocessable', 422, 'unprocessable', data);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.Unprocessable = Unprocessable;
|
|
126
|
-
// 429 Too Many Requests
|
|
127
|
-
class TooManyRequests extends FeathersError {
|
|
128
|
-
constructor(message, data) {
|
|
129
|
-
super(message, 'TooManyRequests', 429, 'too-many-requests', data);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
exports.TooManyRequests = TooManyRequests;
|
|
133
|
-
// 500 - General Error
|
|
134
|
-
class GeneralError extends FeathersError {
|
|
135
|
-
constructor(message, data) {
|
|
136
|
-
super(message, 'GeneralError', 500, 'general-error', data);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
exports.GeneralError = GeneralError;
|
|
140
|
-
// 501 - Not Implemented
|
|
141
|
-
class NotImplemented extends FeathersError {
|
|
142
|
-
constructor(message, data) {
|
|
143
|
-
super(message, 'NotImplemented', 501, 'not-implemented', data);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
exports.NotImplemented = NotImplemented;
|
|
147
|
-
// 502 - Bad Gateway
|
|
148
|
-
class BadGateway extends FeathersError {
|
|
149
|
-
constructor(message, data) {
|
|
150
|
-
super(message, 'BadGateway', 502, 'bad-gateway', data);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
exports.BadGateway = BadGateway;
|
|
154
|
-
// 503 - Unavailable
|
|
155
|
-
class Unavailable extends FeathersError {
|
|
156
|
-
constructor(message, data) {
|
|
157
|
-
super(message, 'Unavailable', 503, 'unavailable', data);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.Unavailable = Unavailable;
|
|
161
|
-
exports.errors = {
|
|
162
|
-
FeathersError,
|
|
163
|
-
BadRequest,
|
|
164
|
-
NotAuthenticated,
|
|
165
|
-
PaymentError,
|
|
166
|
-
Forbidden,
|
|
167
|
-
NotFound,
|
|
168
|
-
MethodNotAllowed,
|
|
169
|
-
NotAcceptable,
|
|
170
|
-
Timeout,
|
|
171
|
-
Conflict,
|
|
172
|
-
LengthRequired,
|
|
173
|
-
Unprocessable,
|
|
174
|
-
TooManyRequests,
|
|
175
|
-
GeneralError,
|
|
176
|
-
NotImplemented,
|
|
177
|
-
BadGateway,
|
|
178
|
-
Unavailable,
|
|
179
|
-
400: BadRequest,
|
|
180
|
-
401: NotAuthenticated,
|
|
181
|
-
402: PaymentError,
|
|
182
|
-
403: Forbidden,
|
|
183
|
-
404: NotFound,
|
|
184
|
-
405: MethodNotAllowed,
|
|
185
|
-
406: NotAcceptable,
|
|
186
|
-
408: Timeout,
|
|
187
|
-
409: Conflict,
|
|
188
|
-
410: Gone,
|
|
189
|
-
411: LengthRequired,
|
|
190
|
-
422: Unprocessable,
|
|
191
|
-
429: TooManyRequests,
|
|
192
|
-
500: GeneralError,
|
|
193
|
-
501: NotImplemented,
|
|
194
|
-
502: BadGateway,
|
|
195
|
-
503: Unavailable
|
|
196
|
-
};
|
|
197
|
-
function convert(error) {
|
|
198
|
-
if (!error) {
|
|
199
|
-
return error;
|
|
200
|
-
}
|
|
201
|
-
const FeathersError = exports.errors[error.name];
|
|
202
|
-
const result = FeathersError
|
|
203
|
-
? new FeathersError(error.message, error.data)
|
|
204
|
-
: new Error(error.message || error);
|
|
205
|
-
if (typeof error === 'object') {
|
|
206
|
-
Object.assign(result, error);
|
|
207
|
-
}
|
|
208
|
-
return result;
|
|
209
|
-
}
|
|
1
|
+
export * from 'feathers/errors';
|
|
210
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/errors",
|
|
3
3
|
"description": "Common error types for Feathers apps",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0-pre.0",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
|
-
"main": "lib/",
|
|
7
|
-
"types": "lib/",
|
|
6
|
+
"main": "lib/index.js",
|
|
8
7
|
"keywords": [
|
|
9
8
|
"feathers",
|
|
10
9
|
"feathers-plugin"
|
|
11
10
|
],
|
|
12
11
|
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git://github.com/feathersjs/feathers.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/feathersjs/feathers/issues"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">= 20"
|
|
29
29
|
},
|
|
30
30
|
"directories": {
|
|
31
31
|
"lib": "lib"
|
|
@@ -49,13 +49,15 @@
|
|
|
49
49
|
"*.js"
|
|
50
50
|
],
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@feathersjs/feathers": "^5.0.37",
|
|
53
52
|
"@types/mocha": "^10.0.10",
|
|
54
|
-
"@types/node": "^
|
|
53
|
+
"@types/node": "^25.1.0",
|
|
55
54
|
"mocha": "^11.7.5",
|
|
56
55
|
"shx": "^0.4.0",
|
|
57
56
|
"ts-node": "^10.9.2",
|
|
58
57
|
"typescript": "^5.9.3"
|
|
59
58
|
},
|
|
60
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8fad4bb3d393794fb98fa5fe7cfc327661fedbd2",
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"feathers": "^6.0.0-pre.7"
|
|
62
|
+
}
|
|
61
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,273 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
name: string
|
|
3
|
-
message: string
|
|
4
|
-
code: number
|
|
5
|
-
className: string
|
|
6
|
-
data?: any
|
|
7
|
-
errors?: any
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export type DynamicError = Error & { [key: string]: any }
|
|
11
|
-
export type ErrorMessage = null | string | DynamicError | { [key: string]: any } | any[]
|
|
12
|
-
|
|
13
|
-
interface ErrorProperties extends Omit<FeathersErrorJSON, 'message'> {
|
|
14
|
-
type: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class FeathersError extends Error {
|
|
18
|
-
readonly type: string
|
|
19
|
-
readonly code: number
|
|
20
|
-
readonly className: string
|
|
21
|
-
readonly data: any
|
|
22
|
-
readonly errors: any
|
|
23
|
-
|
|
24
|
-
constructor(err: ErrorMessage, name: string, code: number, className: string, _data: any) {
|
|
25
|
-
let msg = typeof err === 'string' ? err : 'Error'
|
|
26
|
-
const properties: ErrorProperties = {
|
|
27
|
-
name,
|
|
28
|
-
code,
|
|
29
|
-
className,
|
|
30
|
-
type: 'FeathersError'
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (Array.isArray(_data)) {
|
|
34
|
-
properties.data = _data
|
|
35
|
-
} else if (typeof err === 'object' || _data !== undefined) {
|
|
36
|
-
const { message, errors, ...rest } = err !== null && typeof err === 'object' ? err : _data
|
|
37
|
-
|
|
38
|
-
msg = message || msg
|
|
39
|
-
properties.errors = errors
|
|
40
|
-
properties.data = rest
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
super(msg)
|
|
44
|
-
Object.assign(this, properties)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
toJSON() {
|
|
48
|
-
const result: FeathersErrorJSON = {
|
|
49
|
-
name: this.name,
|
|
50
|
-
message: this.message,
|
|
51
|
-
code: this.code,
|
|
52
|
-
className: this.className
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (this.data !== undefined) {
|
|
56
|
-
result.data = this.data
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (this.errors !== undefined) {
|
|
60
|
-
result.errors = this.errors
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return result
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export class BadRequest extends FeathersError {
|
|
68
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
69
|
-
super(message, 'BadRequest', 400, 'bad-request', data)
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 401 - Not Authenticated
|
|
74
|
-
export class NotAuthenticated extends FeathersError {
|
|
75
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
76
|
-
super(message, 'NotAuthenticated', 401, 'not-authenticated', data)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// 402 - Payment Error
|
|
81
|
-
export class PaymentError extends FeathersError {
|
|
82
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
83
|
-
super(message, 'PaymentError', 402, 'payment-error', data)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// 403 - Forbidden
|
|
88
|
-
export class Forbidden extends FeathersError {
|
|
89
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
90
|
-
super(message, 'Forbidden', 403, 'forbidden', data)
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// 404 - Not Found
|
|
95
|
-
export class NotFound extends FeathersError {
|
|
96
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
97
|
-
super(message, 'NotFound', 404, 'not-found', data)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// 405 - Method Not Allowed
|
|
102
|
-
export class MethodNotAllowed extends FeathersError {
|
|
103
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
104
|
-
super(message, 'MethodNotAllowed', 405, 'method-not-allowed', data)
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 406 - Not Acceptable
|
|
109
|
-
export class NotAcceptable extends FeathersError {
|
|
110
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
111
|
-
super(message, 'NotAcceptable', 406, 'not-acceptable', data)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// 408 - Timeout
|
|
116
|
-
export class Timeout extends FeathersError {
|
|
117
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
118
|
-
super(message, 'Timeout', 408, 'timeout', data)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// 409 - Conflict
|
|
123
|
-
export class Conflict extends FeathersError {
|
|
124
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
125
|
-
super(message, 'Conflict', 409, 'conflict', data)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 410 - Gone
|
|
130
|
-
export class Gone extends FeathersError {
|
|
131
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
132
|
-
super(message, 'Gone', 410, 'gone', data)
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// 411 - Length Required
|
|
137
|
-
export class LengthRequired extends FeathersError {
|
|
138
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
139
|
-
super(message, 'LengthRequired', 411, 'length-required', data)
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 422 Unprocessable
|
|
144
|
-
export class Unprocessable extends FeathersError {
|
|
145
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
146
|
-
super(message, 'Unprocessable', 422, 'unprocessable', data)
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// 429 Too Many Requests
|
|
151
|
-
export class TooManyRequests extends FeathersError {
|
|
152
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
153
|
-
super(message, 'TooManyRequests', 429, 'too-many-requests', data)
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 500 - General Error
|
|
158
|
-
export class GeneralError extends FeathersError {
|
|
159
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
160
|
-
super(message, 'GeneralError', 500, 'general-error', data)
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// 501 - Not Implemented
|
|
165
|
-
export class NotImplemented extends FeathersError {
|
|
166
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
167
|
-
super(message, 'NotImplemented', 501, 'not-implemented', data)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// 502 - Bad Gateway
|
|
172
|
-
export class BadGateway extends FeathersError {
|
|
173
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
174
|
-
super(message, 'BadGateway', 502, 'bad-gateway', data)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// 503 - Unavailable
|
|
179
|
-
export class Unavailable extends FeathersError {
|
|
180
|
-
constructor(message?: ErrorMessage, data?: any) {
|
|
181
|
-
super(message, 'Unavailable', 503, 'unavailable', data)
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export interface Errors {
|
|
186
|
-
FeathersError: FeathersError
|
|
187
|
-
BadRequest: BadRequest
|
|
188
|
-
NotAuthenticated: NotAuthenticated
|
|
189
|
-
PaymentError: PaymentError
|
|
190
|
-
Forbidden: Forbidden
|
|
191
|
-
NotFound: NotFound
|
|
192
|
-
MethodNotAllowed: MethodNotAllowed
|
|
193
|
-
NotAcceptable: NotAcceptable
|
|
194
|
-
Timeout: Timeout
|
|
195
|
-
Conflict: Conflict
|
|
196
|
-
LengthRequired: LengthRequired
|
|
197
|
-
Unprocessable: Unprocessable
|
|
198
|
-
TooManyRequests: TooManyRequests
|
|
199
|
-
GeneralError: GeneralError
|
|
200
|
-
NotImplemented: NotImplemented
|
|
201
|
-
BadGateway: BadGateway
|
|
202
|
-
Unavailable: Unavailable
|
|
203
|
-
400: BadRequest
|
|
204
|
-
401: NotAuthenticated
|
|
205
|
-
402: PaymentError
|
|
206
|
-
403: Forbidden
|
|
207
|
-
404: NotFound
|
|
208
|
-
405: MethodNotAllowed
|
|
209
|
-
406: NotAcceptable
|
|
210
|
-
408: Timeout
|
|
211
|
-
409: Conflict
|
|
212
|
-
411: LengthRequired
|
|
213
|
-
422: Unprocessable
|
|
214
|
-
429: TooManyRequests
|
|
215
|
-
500: GeneralError
|
|
216
|
-
501: NotImplemented
|
|
217
|
-
502: BadGateway
|
|
218
|
-
503: Unavailable
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export const errors = {
|
|
222
|
-
FeathersError,
|
|
223
|
-
BadRequest,
|
|
224
|
-
NotAuthenticated,
|
|
225
|
-
PaymentError,
|
|
226
|
-
Forbidden,
|
|
227
|
-
NotFound,
|
|
228
|
-
MethodNotAllowed,
|
|
229
|
-
NotAcceptable,
|
|
230
|
-
Timeout,
|
|
231
|
-
Conflict,
|
|
232
|
-
LengthRequired,
|
|
233
|
-
Unprocessable,
|
|
234
|
-
TooManyRequests,
|
|
235
|
-
GeneralError,
|
|
236
|
-
NotImplemented,
|
|
237
|
-
BadGateway,
|
|
238
|
-
Unavailable,
|
|
239
|
-
400: BadRequest,
|
|
240
|
-
401: NotAuthenticated,
|
|
241
|
-
402: PaymentError,
|
|
242
|
-
403: Forbidden,
|
|
243
|
-
404: NotFound,
|
|
244
|
-
405: MethodNotAllowed,
|
|
245
|
-
406: NotAcceptable,
|
|
246
|
-
408: Timeout,
|
|
247
|
-
409: Conflict,
|
|
248
|
-
410: Gone,
|
|
249
|
-
411: LengthRequired,
|
|
250
|
-
422: Unprocessable,
|
|
251
|
-
429: TooManyRequests,
|
|
252
|
-
500: GeneralError,
|
|
253
|
-
501: NotImplemented,
|
|
254
|
-
502: BadGateway,
|
|
255
|
-
503: Unavailable
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export function convert(error: any) {
|
|
259
|
-
if (!error) {
|
|
260
|
-
return error
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const FeathersError = (errors as any)[error.name]
|
|
264
|
-
const result = FeathersError
|
|
265
|
-
? new FeathersError(error.message, error.data)
|
|
266
|
-
: new Error(error.message || error)
|
|
267
|
-
|
|
268
|
-
if (typeof error === 'object') {
|
|
269
|
-
Object.assign(result, error)
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
return result
|
|
273
|
-
}
|
|
1
|
+
export * from 'feathers/errors'
|