@eggjs/errors 0.0.0 → 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 CHANGED
@@ -1,23 +1,19 @@
1
- # egg-errors
1
+ # @eggjs/errors
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
- [![Node.js CI](https://github.com/eggjs/egg-errors/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-errors/actions/workflows/nodejs.yml)
5
- [![Test coverage][codecov-image]][codecov-url]
6
4
  [![Known Vulnerabilities][snyk-image]][snyk-url]
7
5
  [![npm download][download-image]][download-url]
8
6
 
9
- [npm-image]: https://img.shields.io/npm/v/egg-errors.svg?style=flat-square
10
- [npm-url]: https://npmjs.org/package/egg-errors
11
- [codecov-image]: https://codecov.io/gh/eggjs/egg-errors/branch/master/graph/badge.svg
12
- [codecov-url]: https://codecov.io/gh/eggjs/egg-errors
13
- [snyk-image]: https://snyk.io/test/npm/egg-errors/badge.svg?style=flat-square
14
- [snyk-url]: https://snyk.io/test/npm/egg-errors
15
- [download-image]: https://img.shields.io/npm/dm/egg-errors.svg?style=flat-square
16
- [download-url]: https://npmjs.org/package/egg-errors
7
+ [npm-image]: https://img.shields.io/npm/v/@eggjs/errors.svg?style=flat-square
8
+ [npm-url]: https://npmjs.org/package/@eggjs/errors
9
+ [snyk-image]: https://snyk.io/test/npm/@eggjs/errors/badge.svg?style=flat-square
10
+ [snyk-url]: https://snyk.io/test/npm/@eggjs/errors
11
+ [download-image]: https://img.shields.io/npm/dm/@eggjs/errors.svg?style=flat-square
12
+ [download-url]: https://npmjs.org/package/@eggjs/errors
17
13
 
18
14
  Errors for [Egg.js](https://eggjs.org)
19
15
 
20
- egg-errors provide two kinds of errors that is Error and Exception.
16
+ `@eggjs/errors` provide two kinds of errors that is Error and Exception.
21
17
 
22
18
  - Exception is system error that egg will log an error and throw exception, but it will be catched by onerror plugin.
23
19
  - Error is business error that egg will transform it to response.
@@ -25,7 +21,7 @@ egg-errors provide two kinds of errors that is Error and Exception.
25
21
  ## Install
26
22
 
27
23
  ```bash
28
- $ npm i egg-errors --save
24
+ $ npm i @eggjs/errors --save
29
25
  ```
30
26
 
31
27
  ## Usage
@@ -33,7 +29,7 @@ $ npm i egg-errors --save
33
29
  Create an Error
34
30
 
35
31
  ```js
36
- const { EggError, EggException } = require('egg-errors');
32
+ const { EggError, EggException } = require('@eggjs/errors');
37
33
  let err = new EggError('egg error');
38
34
  console.log(EggError.getType(err)); // ERROR
39
35
  ```
@@ -59,7 +55,7 @@ console.log(EggError.getType(err)); // ERROR
59
55
  Error can be extendable.
60
56
 
61
57
  ```js
62
- const { EggBaseError } = require('egg-errors');
58
+ const { EggBaseError } = require('@eggjs/errors');
63
59
 
64
60
  class CustomError extends EggBaseError {
65
61
  constructor(message) {
@@ -71,11 +67,12 @@ class CustomError extends EggBaseError {
71
67
  or using typescript you can customize ErrorOptions.
72
68
 
73
69
  ```js
74
- import { EggBaseError, ErrorOptions } from 'egg-errors';
70
+ import { EggBaseError, ErrorOptions } from '@eggjs/errors';
75
71
 
76
72
  class CustomErrorOptions extends ErrorOptions {
77
73
  public data: object;
78
74
  }
75
+
79
76
  class CustomError extends EggBaseError<CustomErrorOptions> {
80
77
  public data: object;
81
78
  protected options: CustomErrorOptions;
@@ -87,14 +84,15 @@ class CustomError extends EggBaseError<CustomErrorOptions> {
87
84
  }
88
85
  ```
89
86
 
90
- 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-errors/blob/master/lib/http/400.ts).
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).
91
88
 
92
89
  ### HTTP Errors
93
90
 
94
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`;
95
92
 
96
93
  ```js
97
- const { ForbiddenError } = require('egg-errors');
94
+ const { ForbiddenError } = require('@eggjs/errors');
95
+
98
96
  const err = new ForbiddenError('your request is forbidden');
99
97
  console.log(err.status); // 403
100
98
  ```
@@ -102,7 +100,8 @@ console.log(err.status); // 403
102
100
  Support short name too:
103
101
 
104
102
  ```js
105
- const { E403 } = require('egg-errors');
103
+ const { E403 } = require('@eggjs/errors');
104
+
106
105
  const err = new E403('your request is forbidden');
107
106
  console.log(err.status); // 403
108
107
  ```
@@ -116,7 +115,7 @@ FrameworkBaseError extends EggBaseError providing three properties which is `mod
116
115
  FrameworkBaseError could not be used directly, framework/plugin should extends like this
117
116
 
118
117
  ```js
119
- const { FrameworkBaseError } = require('egg-errors');
118
+ const { FrameworkBaseError } = require('@eggjs/errors');
120
119
 
121
120
  class EggMysqlError extends FrameworkBaseError {
122
121
  // module should be implement
@@ -137,7 +136,7 @@ console.log(err.errorContext); // { traceId: 'xxx' }
137
136
  use the static method `.create(message: string, serialNumber: string | number, errorContext?: any)` to new a frameworkError and format it convenient
138
137
 
139
138
  ```js
140
- const { FrameworkBaseError } = require('egg-errors');
139
+ const { FrameworkBaseError } = require('@eggjs/errors');
141
140
 
142
141
  class EggMysqlError extends FrameworkBaseError {
143
142
  // module should be implement
@@ -156,10 +155,10 @@ framework.EggMysqlError: error message [ https://eggjs.org/zh-cn/faq/EGG_MYSQL/0
156
155
 
157
156
  FrameworkErrorFormater will append a faq guide url in error message.this would be helpful when developer encountered a framework error
158
157
 
159
- the faq guide url format: `${faqPrefix}/${err.module}/${err.serialNumber}`, `faqPrefix` is `https://eggjs.org/zh-cn/faq` by default. can be extendable or set `process.env.EGG_FRAMEWORK_ERR_FAQ_PERFIX` to override it.
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).
160
159
 
161
160
  ```js
162
- const { FrameworkErrorFormater } = require('egg-errors');
161
+ const { FrameworkErrorFormater } = require('@eggjs/errors');
163
162
 
164
163
  class CustomErrorFormatter extends FrameworkErrorFormater {
165
164
  static faqPrefix = 'http://www.custom.com/faq';
@@ -171,7 +170,7 @@ class CustomErrorFormatter extends FrameworkErrorFormater {
171
170
  format error to message, it will not effect origin error
172
171
 
173
172
  ```js
174
- const { FrameworkBaseError, FrameworkErrorFormater } = require('egg-errors');
173
+ const { FrameworkBaseError, FrameworkErrorFormater } = require('@eggjs/errors');
175
174
 
176
175
  class EggMysqlError extends FrameworkBaseError {
177
176
  // module should be implement
@@ -209,7 +208,7 @@ framework.EggMysqlError: error message [ http://www.custom.com/faq/EGG_MYSQL/01
209
208
  append faq guide url to err.message
210
209
 
211
210
  ```js
212
- const { FrameworkBaseError, FrameworkErrorFormater } = require('egg-errors');
211
+ const { FrameworkBaseError, FrameworkErrorFormater } = require('@eggjs/errors');
213
212
 
214
213
  class EggMysqlError extends FrameworkBaseError {
215
214
  // module should be implement
@@ -246,13 +245,8 @@ Please open an issue [here](https://github.com/eggjs/egg/issues?q=is%3Aissue+is%
246
245
 
247
246
  [MIT](LICENSE)
248
247
 
249
- <!-- GITCONTRIBUTOR_START -->
250
-
251
248
  ## Contributors
252
249
 
253
- | [<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/> | [<img src="https://avatars.githubusercontent.com/u/2160731?v=4" width="100px;"/><br/><sub><b>mansonchor</b></sub>](https://github.com/mansonchor)<br/> | [<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/> | [<img src="https://avatars.githubusercontent.com/u/12657964?v=4" width="100px;"/><br/><sub><b>beliefgp</b></sub>](https://github.com/beliefgp)<br/> | [<img src="https://avatars.githubusercontent.com/u/19644997?v=4" width="100px;"/><br/><sub><b>sm2017</b></sub>](https://github.com/sm2017)<br/> |
254
- | :-----------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------: |
255
-
256
- 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
+ [![Contributors](https://contrib.rocks/image?repo=eggjs/egg)](https://github.com/eggjs/egg/graphs/contributors)
257
251
 
258
- <!-- GITCONTRIBUTOR_END -->
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
- * Create a new instance of the error class from an existing error
12
- * @param err - The error to create a new instance from
13
- * @param args - The arguments to pass to the constructor
14
- * @returns A new instance of the error class
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, TYPE };
35
+ export { BaseError };
@@ -1,11 +1,13 @@
1
1
  import { ErrorType } from "./error_type.js";
2
- import { BaseError, TYPE } from "./base.js";
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(options);
8
- this[TYPE] = ErrorType.ERROR;
7
+ super({
8
+ ...options,
9
+ errorType: ErrorType.ERROR
10
+ });
9
11
  }
10
12
  };
11
13
 
@@ -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
@@ -1,11 +1,13 @@
1
1
  import { ErrorType } from "./error_type.js";
2
- import { BaseError, TYPE } from "./base.js";
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(options);
8
- this[TYPE] = ErrorType.EXCEPTION;
7
+ super({
8
+ errorType: ErrorType.EXCEPTION,
9
+ ...options
10
+ });
9
11
  }
10
12
  };
11
13
 
@@ -1,6 +1,9 @@
1
+ import { ErrorType } from "./error_type.js";
2
+
1
3
  //#region src/error_options.d.ts
2
- declare class ErrorOptions {
4
+ interface ErrorOptions {
3
5
  code?: string;
6
+ errorType?: ErrorType;
4
7
  message: string;
5
8
  [key: string]: any;
6
9
  }
@@ -1,16 +1,16 @@
1
1
  //#region src/error_type.d.ts
2
2
  declare const ErrorType: {
3
3
  /**
4
- * Built-in Error
5
- */
4
+ * Built-in Error
5
+ */
6
6
  readonly BUILTIN: "BUILTIN";
7
7
  /**
8
- * Egg Error
9
- */
8
+ * Egg Error
9
+ */
10
10
  readonly ERROR: "ERROR";
11
11
  /**
12
- * Egg Exception
13
- */
12
+ * Egg Exception
13
+ */
14
14
  readonly EXCEPTION: "EXCEPTION";
15
15
  };
16
16
  type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
@@ -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<ErrorOptions> {
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 FrameworkErrorFormater {
2
+ declare class FrameworkErrorFormatter {
3
3
  protected static faqPrefix: string;
4
4
  /**
5
- * Custom framework error FAQ prefix
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 { FrameworkErrorFormater };
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 FrameworkErrorFormater = class {
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 { FrameworkErrorFormater };
28
+ export { FrameworkErrorFormatter };
@@ -1,5 +1,5 @@
1
1
  import { EggBaseError } from "../base_error.js";
2
- import { FrameworkErrorFormater } from "./formatter.js";
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 implement");
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 = FrameworkErrorFormater.formatError(new this(message, serialNumber, errorContext));
27
+ const err = FrameworkErrorFormatter.formatError(new this(message, serialNumber, errorContext));
28
28
  Error.captureStackTrace(err, this.create);
29
29
  return err;
30
30
  }
@@ -6,7 +6,6 @@ var HttpError = class extends EggBaseError {
6
6
  headers;
7
7
  constructor(options) {
8
8
  super(options);
9
- this.headers = {};
10
9
  this.status = this.options.status;
11
10
  this.headers = this.options.headers ?? {};
12
11
  }
@@ -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
- declare class HttpErrorOptions extends ErrorOptions {
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 { FrameworkErrorFormater } from "./framework/formatter.js";
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 { FrameworkErrorFormater } from "./framework/formatter.js";
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, 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, 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": "0.0.0",
4
- "description": "egg-errors provide two kinds of errors that is Error and Exception.",
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,16 +29,12 @@
29
29
  },
30
30
  "dependencies": {},
31
31
  "devDependencies": {
32
- "@types/node": "^24.6.2",
33
- "mm": "^4.0.2",
34
- "oxlint": "^1.19.0",
35
- "rimraf": "^6.0.1",
36
- "statuses": "^2.0.1",
37
- "toidentifier": "^1.0.0",
38
- "tsdown": "^0.15.4",
32
+ "@types/node": "^24.7.2",
33
+ "oxlint": "^1.23.0",
34
+ "tsdown": "^0.15.6",
39
35
  "typescript": "^5.9.3",
40
- "vitest": "4.0.0-beta.16",
41
- "@eggjs/tsconfig": "3.1.0-beta.27"
36
+ "vitest": "4.0.0-beta.18",
37
+ "@eggjs/tsconfig": "3.1.0-beta.28"
42
38
  },
43
39
  "main": "./dist/index.js",
44
40
  "module": "./dist/index.js",
@@ -1,8 +0,0 @@
1
- //#region src/error_options.ts
2
- var ErrorOptions = class {
3
- code;
4
- message;
5
- };
6
-
7
- //#endregion
8
- export { ErrorOptions };