@eggjs/errors 3.0.0-beta.2 → 3.0.0-beta.28
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 +19 -21
- package/dist/base.d.ts +6 -8
- package/dist/base.js +2 -2
- package/dist/base_error.js +5 -3
- package/dist/base_exception.d.ts +1 -1
- package/dist/base_exception.js +5 -3
- package/dist/error_options.d.ts +4 -1
- package/dist/error_type.d.ts +6 -6
- package/dist/exception.d.ts +1 -2
- package/dist/framework/formatter.d.ts +4 -4
- package/dist/framework/formatter.js +3 -3
- package/dist/framework/framework_base_error.js +3 -3
- package/dist/http/http_error.js +0 -1
- package/dist/http/http_error_options.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -3
- package/package.json +7 -7
- package/dist/error_options.js +0 -8
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
Errors for [Egg.js](https://eggjs.org)
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
`@eggjs/errors` provide two kinds of errors that is Error and Exception.
|
|
17
17
|
|
|
18
18
|
- Exception is system error that egg will log an error and throw exception, but it will be catched by onerror plugin.
|
|
19
19
|
- Error is business error that egg will transform it to response.
|
|
@@ -21,7 +21,7 @@ egg-errors provide two kinds of errors that is Error and Exception.
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
$ npm i
|
|
24
|
+
$ npm i @eggjs/errors --save
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Usage
|
|
@@ -29,7 +29,7 @@ $ npm i egg-errors --save
|
|
|
29
29
|
Create an Error
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
const { EggError, EggException } = require('
|
|
32
|
+
const { EggError, EggException } = require('@eggjs/errors');
|
|
33
33
|
let err = new EggError('egg error');
|
|
34
34
|
console.log(EggError.getType(err)); // ERROR
|
|
35
35
|
```
|
|
@@ -55,7 +55,7 @@ console.log(EggError.getType(err)); // ERROR
|
|
|
55
55
|
Error can be extendable.
|
|
56
56
|
|
|
57
57
|
```js
|
|
58
|
-
const { EggBaseError } = require('
|
|
58
|
+
const { EggBaseError } = require('@eggjs/errors');
|
|
59
59
|
|
|
60
60
|
class CustomError extends EggBaseError {
|
|
61
61
|
constructor(message) {
|
|
@@ -67,11 +67,12 @@ class CustomError extends EggBaseError {
|
|
|
67
67
|
or using typescript you can customize ErrorOptions.
|
|
68
68
|
|
|
69
69
|
```js
|
|
70
|
-
import { EggBaseError, ErrorOptions } from '
|
|
70
|
+
import { EggBaseError, ErrorOptions } from '@eggjs/errors';
|
|
71
71
|
|
|
72
72
|
class CustomErrorOptions extends ErrorOptions {
|
|
73
73
|
public data: object;
|
|
74
74
|
}
|
|
75
|
+
|
|
75
76
|
class CustomError extends EggBaseError<CustomErrorOptions> {
|
|
76
77
|
public data: object;
|
|
77
78
|
protected options: CustomErrorOptions;
|
|
@@ -83,14 +84,15 @@ class CustomError extends EggBaseError<CustomErrorOptions> {
|
|
|
83
84
|
}
|
|
84
85
|
```
|
|
85
86
|
|
|
86
|
-
Recommend use message instead of options in user land that it can be easily understood by developer, see [http error](https://github.com/eggjs/egg
|
|
87
|
+
Recommend use message instead of options in user land that it can be easily understood by developer, see [http error](https://github.com/eggjs/egg/blob/master/packages/errors/src/http/400.ts).
|
|
87
88
|
|
|
88
89
|
### HTTP Errors
|
|
89
90
|
|
|
90
91
|
HTTP Errors is BUILTIN errors that transform 400 ~ 500 status code to error objects. HttpError extends EggBaseError providing two properties which is `status` and `headers`;
|
|
91
92
|
|
|
92
93
|
```js
|
|
93
|
-
const { ForbiddenError } = require('
|
|
94
|
+
const { ForbiddenError } = require('@eggjs/errors');
|
|
95
|
+
|
|
94
96
|
const err = new ForbiddenError('your request is forbidden');
|
|
95
97
|
console.log(err.status); // 403
|
|
96
98
|
```
|
|
@@ -98,7 +100,8 @@ console.log(err.status); // 403
|
|
|
98
100
|
Support short name too:
|
|
99
101
|
|
|
100
102
|
```js
|
|
101
|
-
const { E403 } = require('
|
|
103
|
+
const { E403 } = require('@eggjs/errors');
|
|
104
|
+
|
|
102
105
|
const err = new E403('your request is forbidden');
|
|
103
106
|
console.log(err.status); // 403
|
|
104
107
|
```
|
|
@@ -112,7 +115,7 @@ FrameworkBaseError extends EggBaseError providing three properties which is `mod
|
|
|
112
115
|
FrameworkBaseError could not be used directly, framework/plugin should extends like this
|
|
113
116
|
|
|
114
117
|
```js
|
|
115
|
-
const { FrameworkBaseError } = require('
|
|
118
|
+
const { FrameworkBaseError } = require('@eggjs/errors');
|
|
116
119
|
|
|
117
120
|
class EggMysqlError extends FrameworkBaseError {
|
|
118
121
|
// module should be implement
|
|
@@ -133,7 +136,7 @@ console.log(err.errorContext); // { traceId: 'xxx' }
|
|
|
133
136
|
use the static method `.create(message: string, serialNumber: string | number, errorContext?: any)` to new a frameworkError and format it convenient
|
|
134
137
|
|
|
135
138
|
```js
|
|
136
|
-
const { FrameworkBaseError } = require('
|
|
139
|
+
const { FrameworkBaseError } = require('@eggjs/errors');
|
|
137
140
|
|
|
138
141
|
class EggMysqlError extends FrameworkBaseError {
|
|
139
142
|
// module should be implement
|
|
@@ -152,10 +155,10 @@ framework.EggMysqlError: error message [ https://eggjs.org/zh-cn/faq/EGG_MYSQL/0
|
|
|
152
155
|
|
|
153
156
|
FrameworkErrorFormater will append a faq guide url in error message.this would be helpful when developer encountered a framework error
|
|
154
157
|
|
|
155
|
-
the faq guide url format: `${faqPrefix}/${err.module}/${err.serialNumber}`, `faqPrefix` is `https://eggjs.org/zh-cn/faq` by default. can be
|
|
158
|
+
the faq guide url format: `${faqPrefix}/${err.module}/${err.serialNumber}`, `faqPrefix` is `https://eggjs.org/zh-cn/faq` by default. It can be extended or overridden by setting `process.env.EGG_FRAMEWORK_ERR_FAQ_PREFIX` (recommended) or, for backward compatibility, `process.env.EGG_FRAMEWORK_ERR_FAQ_PERFIX` (legacy typo).
|
|
156
159
|
|
|
157
160
|
```js
|
|
158
|
-
const { FrameworkErrorFormater } = require('
|
|
161
|
+
const { FrameworkErrorFormater } = require('@eggjs/errors');
|
|
159
162
|
|
|
160
163
|
class CustomErrorFormatter extends FrameworkErrorFormater {
|
|
161
164
|
static faqPrefix = 'http://www.custom.com/faq';
|
|
@@ -167,7 +170,7 @@ class CustomErrorFormatter extends FrameworkErrorFormater {
|
|
|
167
170
|
format error to message, it will not effect origin error
|
|
168
171
|
|
|
169
172
|
```js
|
|
170
|
-
const { FrameworkBaseError, FrameworkErrorFormater } = require('
|
|
173
|
+
const { FrameworkBaseError, FrameworkErrorFormater } = require('@eggjs/errors');
|
|
171
174
|
|
|
172
175
|
class EggMysqlError extends FrameworkBaseError {
|
|
173
176
|
// module should be implement
|
|
@@ -205,7 +208,7 @@ framework.EggMysqlError: error message [ http://www.custom.com/faq/EGG_MYSQL/01
|
|
|
205
208
|
append faq guide url to err.message
|
|
206
209
|
|
|
207
210
|
```js
|
|
208
|
-
const { FrameworkBaseError, FrameworkErrorFormater } = require('
|
|
211
|
+
const { FrameworkBaseError, FrameworkErrorFormater } = require('@eggjs/errors');
|
|
209
212
|
|
|
210
213
|
class EggMysqlError extends FrameworkBaseError {
|
|
211
214
|
// module should be implement
|
|
@@ -242,13 +245,8 @@ Please open an issue [here](https://github.com/eggjs/egg/issues?q=is%3Aissue+is%
|
|
|
242
245
|
|
|
243
246
|
[MIT](LICENSE)
|
|
244
247
|
|
|
245
|
-
<!-- GITCONTRIBUTOR_START -->
|
|
246
|
-
|
|
247
248
|
## Contributors
|
|
248
249
|
|
|
249
|
-
|
|
250
|
-
| :-----------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
251
|
-
|
|
252
|
-
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Tue Feb 22 2022 11:32:47 GMT+0800`.
|
|
250
|
+
[](https://github.com/eggjs/egg/graphs/contributors)
|
|
253
251
|
|
|
254
|
-
|
|
252
|
+
Made with [contributors-img](https://contrib.rocks).
|
package/dist/base.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { ErrorOptions } from "./error_options.js";
|
|
2
1
|
import { ErrorType } from "./error_type.js";
|
|
2
|
+
import { ErrorOptions } from "./error_options.js";
|
|
3
3
|
|
|
4
4
|
//#region src/base.d.ts
|
|
5
|
-
declare const TYPE: symbol;
|
|
6
5
|
declare class BaseError<T extends ErrorOptions> extends Error {
|
|
7
|
-
[TYPE]?: ErrorType | undefined;
|
|
8
6
|
[key: string]: any;
|
|
9
7
|
static getType(err: Error): ErrorType;
|
|
10
8
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
* Create a new instance of the error class from an existing error
|
|
10
|
+
* @param err - The error to create a new instance from
|
|
11
|
+
* @param args - The arguments to pass to the constructor
|
|
12
|
+
* @returns A new instance of the error class
|
|
13
|
+
*/
|
|
16
14
|
static from<S extends new (...args: any) => InstanceType<typeof BaseError>, P extends ConstructorParameters<S>>(this: S, err: Error, ...args: P | undefined[]): InstanceType<S>;
|
|
17
15
|
code: string;
|
|
18
16
|
protected options: T;
|
package/dist/base.js
CHANGED
|
@@ -3,7 +3,6 @@ import { ErrorType } from "./error_type.js";
|
|
|
3
3
|
//#region src/base.ts
|
|
4
4
|
const TYPE = Symbol.for("BaseError#type");
|
|
5
5
|
var BaseError = class extends Error {
|
|
6
|
-
[TYPE];
|
|
7
6
|
static getType(err) {
|
|
8
7
|
return err[TYPE] ?? ErrorType.BUILTIN;
|
|
9
8
|
}
|
|
@@ -28,8 +27,9 @@ var BaseError = class extends Error {
|
|
|
28
27
|
this.message = this.options.message ?? "";
|
|
29
28
|
this.code = this.options.code ?? "";
|
|
30
29
|
this.name = this.constructor.name;
|
|
30
|
+
if (this.options.errorType) this[TYPE] = this.options.errorType;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
|
-
export { BaseError
|
|
35
|
+
export { BaseError };
|
package/dist/base_error.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ErrorType } from "./error_type.js";
|
|
2
|
-
import { BaseError
|
|
2
|
+
import { BaseError } from "./base.js";
|
|
3
3
|
|
|
4
4
|
//#region src/base_error.ts
|
|
5
5
|
var EggBaseError = class extends BaseError {
|
|
6
6
|
constructor(options) {
|
|
7
|
-
super(
|
|
8
|
-
|
|
7
|
+
super({
|
|
8
|
+
...options,
|
|
9
|
+
errorType: ErrorType.ERROR
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
12
|
};
|
|
11
13
|
|
package/dist/base_exception.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ErrorOptions } from "./error_options.js";
|
|
|
2
2
|
import { BaseError } from "./base.js";
|
|
3
3
|
|
|
4
4
|
//#region src/base_exception.d.ts
|
|
5
|
-
declare class EggBaseException<T extends ErrorOptions> extends BaseError<T> {
|
|
5
|
+
declare class EggBaseException<T extends ErrorOptions = ErrorOptions> extends BaseError<T> {
|
|
6
6
|
constructor(options?: T);
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
package/dist/base_exception.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ErrorType } from "./error_type.js";
|
|
2
|
-
import { BaseError
|
|
2
|
+
import { BaseError } from "./base.js";
|
|
3
3
|
|
|
4
4
|
//#region src/base_exception.ts
|
|
5
5
|
var EggBaseException = class extends BaseError {
|
|
6
6
|
constructor(options) {
|
|
7
|
-
super(
|
|
8
|
-
|
|
7
|
+
super({
|
|
8
|
+
errorType: ErrorType.EXCEPTION,
|
|
9
|
+
...options
|
|
10
|
+
});
|
|
9
11
|
}
|
|
10
12
|
};
|
|
11
13
|
|
package/dist/error_options.d.ts
CHANGED
package/dist/error_type.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
//#region src/error_type.d.ts
|
|
2
2
|
declare const ErrorType: {
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Built-in Error
|
|
5
|
+
*/
|
|
6
6
|
readonly BUILTIN: "BUILTIN";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Egg Error
|
|
9
|
+
*/
|
|
10
10
|
readonly ERROR: "ERROR";
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Egg Exception
|
|
13
|
+
*/
|
|
14
14
|
readonly EXCEPTION: "EXCEPTION";
|
|
15
15
|
};
|
|
16
16
|
type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
|
package/dist/exception.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ErrorOptions } from "./error_options.js";
|
|
2
1
|
import { EggBaseException } from "./base_exception.js";
|
|
3
2
|
|
|
4
3
|
//#region src/exception.d.ts
|
|
5
|
-
declare class EggException extends EggBaseException
|
|
4
|
+
declare class EggException extends EggBaseException {
|
|
6
5
|
constructor(message?: string);
|
|
7
6
|
}
|
|
8
7
|
//#endregion
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
//#region src/framework/formatter.d.ts
|
|
2
|
-
declare class
|
|
2
|
+
declare class FrameworkErrorFormatter {
|
|
3
3
|
protected static faqPrefix: string;
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* Custom framework error FAQ prefix
|
|
6
|
+
*/
|
|
7
7
|
private static faqPrefixEnv;
|
|
8
8
|
static format(err: Error): string;
|
|
9
9
|
static formatError<T extends Error>(err: T): T;
|
|
10
10
|
}
|
|
11
11
|
//#endregion
|
|
12
|
-
export {
|
|
12
|
+
export { FrameworkErrorFormatter };
|
|
@@ -4,12 +4,12 @@ import os from "node:os";
|
|
|
4
4
|
|
|
5
5
|
//#region src/framework/formatter.ts
|
|
6
6
|
const hostname = os.hostname();
|
|
7
|
-
var
|
|
7
|
+
var FrameworkErrorFormatter = class {
|
|
8
8
|
static faqPrefix = "https://eggjs.org/zh-cn/faq";
|
|
9
9
|
/**
|
|
10
10
|
* Custom framework error FAQ prefix
|
|
11
11
|
*/
|
|
12
|
-
static faqPrefixEnv = process.env.EGG_FRAMEWORK_ERR_FAQ_PERFIX;
|
|
12
|
+
static faqPrefixEnv = process.env.EGG_FRAMEWORK_ERR_FAQ_PREFIX ?? process.env.EGG_FRAMEWORK_ERR_FAQ_PERFIX;
|
|
13
13
|
static format(err) {
|
|
14
14
|
const faqPrefix = this.faqPrefixEnv ?? this.faqPrefix;
|
|
15
15
|
let errMessage = err.message;
|
|
@@ -25,4 +25,4 @@ var FrameworkErrorFormater = class {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export { FrameworkErrorFormatter };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EggBaseError } from "../base_error.js";
|
|
2
|
-
import {
|
|
2
|
+
import { FrameworkErrorFormatter } from "./formatter.js";
|
|
3
3
|
import assert from "node:assert";
|
|
4
4
|
|
|
5
5
|
//#region src/framework/framework_base_error.ts
|
|
@@ -8,7 +8,7 @@ var FrameworkBaseError = class extends EggBaseError {
|
|
|
8
8
|
serialNumber;
|
|
9
9
|
errorContext;
|
|
10
10
|
get module() {
|
|
11
|
-
throw new Error("module should be
|
|
11
|
+
throw new Error("module should be implemented");
|
|
12
12
|
}
|
|
13
13
|
constructor(message, serialNumber, errorContext) {
|
|
14
14
|
super({
|
|
@@ -24,7 +24,7 @@ var FrameworkBaseError = class extends EggBaseError {
|
|
|
24
24
|
this[FRAMEWORK_ERROR_SYMBOL] = true;
|
|
25
25
|
}
|
|
26
26
|
static create(message, serialNumber, errorContext) {
|
|
27
|
-
const err =
|
|
27
|
+
const err = FrameworkErrorFormatter.formatError(new this(message, serialNumber, errorContext));
|
|
28
28
|
Error.captureStackTrace(err, this.create);
|
|
29
29
|
return err;
|
|
30
30
|
}
|
package/dist/http/http_error.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ErrorOptions } from "../error_options.js";
|
|
|
2
2
|
import { HttpHeader } from "./http_header.js";
|
|
3
3
|
|
|
4
4
|
//#region src/http/http_error_options.d.ts
|
|
5
|
-
|
|
5
|
+
interface HttpErrorOptions extends ErrorOptions {
|
|
6
6
|
status: number;
|
|
7
7
|
headers?: HttpHeader;
|
|
8
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ErrorOptions } from "./error_options.js";
|
|
2
1
|
import { ErrorType } from "./error_type.js";
|
|
2
|
+
import { ErrorOptions } from "./error_options.js";
|
|
3
3
|
import { EggBaseError } from "./base_error.js";
|
|
4
4
|
import { EggBaseException } from "./base_exception.js";
|
|
5
5
|
import { EggError } from "./error.js";
|
|
6
6
|
import { EggException } from "./exception.js";
|
|
7
7
|
import { FRAMEWORK_ERROR_SYMBOL, FrameworkBaseError } from "./framework/framework_base_error.js";
|
|
8
|
-
import {
|
|
8
|
+
import { FrameworkErrorFormatter } from "./framework/formatter.js";
|
|
9
9
|
import { HttpError } from "./http/http_error.js";
|
|
10
10
|
import { BadRequestError } from "./http/400.js";
|
|
11
11
|
import { UnauthorizedError } from "./http/401.js";
|
|
@@ -48,4 +48,4 @@ import { LoopDetectedError } from "./http/508.js";
|
|
|
48
48
|
import { BandwidthLimitExceededError } from "./http/509.js";
|
|
49
49
|
import { NotExtendedError } from "./http/510.js";
|
|
50
50
|
import { NetworkAuthenticationRequiredError } from "./http/511.js";
|
|
51
|
-
export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, BadRequestError as E400, UnauthorizedError as E401, PaymentRequiredError as E402, ForbiddenError as E403, NotFoundError as E404, MethodNotAllowedError as E405, NotAcceptableError as E406, ProxyAuthenticationRequiredError as E407, RequestTimeoutError as E408, ConflictError as E409, GoneError as E410, LengthRequiredError as E411, PreconditionFailedError as E412, PayloadTooLargeError as E413, URITooLongError as E414, UnsupportedMediaTypeError as E415, RangeNotSatisfiableError as E416, ExpectationFailedError as E417, ImATeapotError as E418, MisdirectedRequestError as E421, UnprocessableEntityError as E422, LockedError as E423, FailedDependencyError as E424, UnorderedCollectionError as E425, UpgradeRequiredError as E426, PreconditionRequiredError as E428, TooManyRequestsError as E429, RequestHeaderFieldsTooLargeError as E431, UnavailableForLegalReasonsError as E451, InternalServerError as E500, NotImplementedError as E501, BadGatewayError as E502, ServiceUnavailableError as E503, GatewayTimeoutError as E504, HTTPVersionNotSupportedError as E505, VariantAlsoNegotiatesError as E506, InsufficientStorageError as E507, LoopDetectedError as E508, BandwidthLimitExceededError as E509, NotExtendedError as E510, NetworkAuthenticationRequiredError as E511, EggBaseError, EggBaseException, EggError, EggException, ErrorOptions, ErrorType, ExpectationFailedError, FRAMEWORK_ERROR_SYMBOL, FailedDependencyError, ForbiddenError, FrameworkBaseError, FrameworkErrorFormater, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, HttpError, ImATeapotError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnavailableForLegalReasonsError, UnorderedCollectionError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError };
|
|
51
|
+
export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, BadRequestError as E400, UnauthorizedError as E401, PaymentRequiredError as E402, ForbiddenError as E403, NotFoundError as E404, MethodNotAllowedError as E405, NotAcceptableError as E406, ProxyAuthenticationRequiredError as E407, RequestTimeoutError as E408, ConflictError as E409, GoneError as E410, LengthRequiredError as E411, PreconditionFailedError as E412, PayloadTooLargeError as E413, URITooLongError as E414, UnsupportedMediaTypeError as E415, RangeNotSatisfiableError as E416, ExpectationFailedError as E417, ImATeapotError as E418, MisdirectedRequestError as E421, UnprocessableEntityError as E422, LockedError as E423, FailedDependencyError as E424, UnorderedCollectionError as E425, UpgradeRequiredError as E426, PreconditionRequiredError as E428, TooManyRequestsError as E429, RequestHeaderFieldsTooLargeError as E431, UnavailableForLegalReasonsError as E451, InternalServerError as E500, NotImplementedError as E501, BadGatewayError as E502, ServiceUnavailableError as E503, GatewayTimeoutError as E504, HTTPVersionNotSupportedError as E505, VariantAlsoNegotiatesError as E506, InsufficientStorageError as E507, LoopDetectedError as E508, BandwidthLimitExceededError as E509, NotExtendedError as E510, NetworkAuthenticationRequiredError as E511, EggBaseError, EggBaseException, EggError, EggException, ErrorOptions, ErrorType, ExpectationFailedError, FRAMEWORK_ERROR_SYMBOL, FailedDependencyError, ForbiddenError, FrameworkBaseError, FrameworkErrorFormatter as FrameworkErrorFormater, FrameworkErrorFormatter, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, HttpError, ImATeapotError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnavailableForLegalReasonsError, UnorderedCollectionError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ErrorOptions } from "./error_options.js";
|
|
2
1
|
import { ErrorType } from "./error_type.js";
|
|
3
2
|
import { EggBaseError } from "./base_error.js";
|
|
4
3
|
import { EggBaseException } from "./base_exception.js";
|
|
5
4
|
import { EggError } from "./error.js";
|
|
6
5
|
import { EggException } from "./exception.js";
|
|
7
|
-
import {
|
|
6
|
+
import { FrameworkErrorFormatter } from "./framework/formatter.js";
|
|
8
7
|
import { FRAMEWORK_ERROR_SYMBOL, FrameworkBaseError } from "./framework/framework_base_error.js";
|
|
9
8
|
import { HttpError } from "./http/http_error.js";
|
|
10
9
|
import { BadRequestError } from "./http/400.js";
|
|
@@ -49,4 +48,4 @@ import { BandwidthLimitExceededError } from "./http/509.js";
|
|
|
49
48
|
import { NotExtendedError } from "./http/510.js";
|
|
50
49
|
import { NetworkAuthenticationRequiredError } from "./http/511.js";
|
|
51
50
|
|
|
52
|
-
export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, BadRequestError as E400, UnauthorizedError as E401, PaymentRequiredError as E402, ForbiddenError as E403, NotFoundError as E404, MethodNotAllowedError as E405, NotAcceptableError as E406, ProxyAuthenticationRequiredError as E407, RequestTimeoutError as E408, ConflictError as E409, GoneError as E410, LengthRequiredError as E411, PreconditionFailedError as E412, PayloadTooLargeError as E413, URITooLongError as E414, UnsupportedMediaTypeError as E415, RangeNotSatisfiableError as E416, ExpectationFailedError as E417, ImATeapotError as E418, MisdirectedRequestError as E421, UnprocessableEntityError as E422, LockedError as E423, FailedDependencyError as E424, UnorderedCollectionError as E425, UpgradeRequiredError as E426, PreconditionRequiredError as E428, TooManyRequestsError as E429, RequestHeaderFieldsTooLargeError as E431, UnavailableForLegalReasonsError as E451, InternalServerError as E500, NotImplementedError as E501, BadGatewayError as E502, ServiceUnavailableError as E503, GatewayTimeoutError as E504, HTTPVersionNotSupportedError as E505, VariantAlsoNegotiatesError as E506, InsufficientStorageError as E507, LoopDetectedError as E508, BandwidthLimitExceededError as E509, NotExtendedError as E510, NetworkAuthenticationRequiredError as E511, EggBaseError, EggBaseException, EggError, EggException,
|
|
51
|
+
export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, BadRequestError as E400, UnauthorizedError as E401, PaymentRequiredError as E402, ForbiddenError as E403, NotFoundError as E404, MethodNotAllowedError as E405, NotAcceptableError as E406, ProxyAuthenticationRequiredError as E407, RequestTimeoutError as E408, ConflictError as E409, GoneError as E410, LengthRequiredError as E411, PreconditionFailedError as E412, PayloadTooLargeError as E413, URITooLongError as E414, UnsupportedMediaTypeError as E415, RangeNotSatisfiableError as E416, ExpectationFailedError as E417, ImATeapotError as E418, MisdirectedRequestError as E421, UnprocessableEntityError as E422, LockedError as E423, FailedDependencyError as E424, UnorderedCollectionError as E425, UpgradeRequiredError as E426, PreconditionRequiredError as E428, TooManyRequestsError as E429, RequestHeaderFieldsTooLargeError as E431, UnavailableForLegalReasonsError as E451, InternalServerError as E500, NotImplementedError as E501, BadGatewayError as E502, ServiceUnavailableError as E503, GatewayTimeoutError as E504, HTTPVersionNotSupportedError as E505, VariantAlsoNegotiatesError as E506, InsufficientStorageError as E507, LoopDetectedError as E508, BandwidthLimitExceededError as E509, NotExtendedError as E510, NetworkAuthenticationRequiredError as E511, EggBaseError, EggBaseException, EggError, EggException, ErrorType, ExpectationFailedError, FRAMEWORK_ERROR_SYMBOL, FailedDependencyError, ForbiddenError, FrameworkBaseError, FrameworkErrorFormatter as FrameworkErrorFormater, FrameworkErrorFormatter, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, HttpError, ImATeapotError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PayloadTooLargeError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, ServiceUnavailableError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnavailableForLegalReasonsError, UnorderedCollectionError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/errors",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0-beta.28",
|
|
4
|
+
"description": "@eggjs/errors provide two kinds of errors that is Error and Exception.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./dist/index.js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^24.
|
|
33
|
-
"oxlint": "^1.
|
|
34
|
-
"tsdown": "^0.15.
|
|
32
|
+
"@types/node": "^24.7.2",
|
|
33
|
+
"oxlint": "^1.23.0",
|
|
34
|
+
"tsdown": "^0.15.6",
|
|
35
35
|
"typescript": "^5.9.3",
|
|
36
|
-
"vitest": "4.0.0-beta.
|
|
37
|
-
"@eggjs/tsconfig": "3.1.0-beta.
|
|
36
|
+
"vitest": "4.0.0-beta.18",
|
|
37
|
+
"@eggjs/tsconfig": "3.1.0-beta.28"
|
|
38
38
|
},
|
|
39
39
|
"main": "./dist/index.js",
|
|
40
40
|
"module": "./dist/index.js",
|