@ant-basement/errors
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Basement 错误码统一定义


Getting Started

npm install --save @ant-basement/errors

错误列表以及签名

应用错误:

  • new TenantNotAvailableError(message?: string, errors: any = {})
  • new SpaceNotFoundError(message?: string, errors: any = {})
  • new ResourceNotInitializedError(message?: string, errors: any = {})
  • new DecisionNotFoundError(message?: string, errors: any = {})
  • new UnauthorizedError(message?: string, errors: any = {})
  • new ExceedQuotaError(message?: string, errors: any = {})
  • new ServiceLimitError(message?: string, errors: any = {})
  • new PolicyDeniedError(message?: string, errors: any = {})
  • new PolicySyntaxError(message?: string, errors: any = {})

通用错误:

  • new ValidationError(message?: string, errors: any = {})
  • new UnsupportedError(message?: string, errors: any = {})
  • new NotFoundError(message?: string, errors: any = {})
  • new TimeoutError(message?: string, errors: any = {})

系统/依赖错误:

  • new InternalServerError(e: Error)
  • new ConnectionError(e: Error)
  • new ParseError(e: Error)

最佳实践

try {
  throw new NotFoundError('command', { input: 'readme' });
} catch (err) {
  const data = err.inspect();
  // data.code;
  // data.errors;
  // data.message;
  // data.reference;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @ant-basement/errors

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

40.9 kB

Total Files

23

Last publish

Collaborators

  • lulin
  • zack-lin
  • shouna.ysn
  • sanglv