1.0.4 • Published 4 years ago

@ant-basement/errors v1.0.4

Weekly downloads
21
License
MIT
Repository
-
Last release
4 years ago

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;
}
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago